Traders work on the floor of the New York Stock Exchange as a television screen displays Federal Reserve Chair Janet Yellen speaking, June 17, 2015. Reuters/Lucas Jackson

U.S. stocks traded mildly higher Wednesday amid congressional testimony from Federal Reserve Chairwoman Janet Yellen on the health of the economy. Yellen, who appeared before the House Financial Services Committee in Washington, D.C., on Wednesday morning, said the central bank is on course to raise interest rates this year if the economic conditions “evolve” as expected, laying the groundwork for the Fed's first rate hike since 2006.

In afternoon trading, the Dow Jones Industrial Average (INDEXDJX:.DJI) gained 15.93 points, or 0.09 percent, to 18,069.51. The Standard & Poor's 500 index (INDEXSP:.INX) edged up 2.15 points, or 0.10 percent, to 2,110.99. And the Nasdaq composite (INDEXNASDAQ:.IXIC) rose 6.09 points, or 0.12 percent, to 5,110.98.

The Humphrey-Hawkins Act was a law passed in 1978. It requires that the Federal Reserve address Congress biannually to discuss the central bank’s current monetary policy, including its dual mandate of stabilizing U.S. inflation and achieving maximum employment.

During Yellen’s two-day semiannual “Humphrey-Hawkins” testimony, the Fed chairwoman said the U.S. unemployment rate should decline, but inflation still remains below the Fed's 2 percent target. "If the economy evolves as we expect, economic conditions likely would make it appropriate at some point this year to raise the federal funds rate target, thereby beginning to normalize the stance of monetary policy," Yellen said in prepared remarks Wednesday.

Yellen struck a similar tone during a separate speech last week, saying she expected U.S. interest rates would rise sometime this year, which would mark the first time in nearly a decade the central bank has lifted rates that have also hovered at historic lows since the financial crisis of 2007-09.

But there appears to be a consensus among Fed officials that policy firming should occur slowly, and recent economic data seem to have convinced them that rate increases should be more gradual than previously believed. “Regardless of when the liftoff comes, we can expect a moderate pace of increases and low interest rates in coming years,” the American Institute for Economic Research said in its monthly business conditions report.

Effective Federal Funds Rate | FindTheData

Yellen also discussed some uncertainties in the Fed’s economic outlook that could potentially pose some risks to U.S. growth.

“Although the recovery in the euro area appears to have gained a firmer footing, the situation in Greece remains difficult,” Yellen said, adding that China continues to “grapple with the challenges” posed by high debt, weak property markets and volatile financial conditions.

Yellen is scheduled to appear before the Senate Banking Committee on Thursday.

Following her testimony, the financial sector led the S&P 500 slightly higher, up nearly 1 percent, while the energy sector was the largest decliner, down more than 1 percent.

Dow component Johnson & Johnson (NYSE:JNJ) led the index higher, up 1 percent, while Chevron Corporation (NYSE:CVX) lost 1 percent.

Shares of Bank of America Corp. (NYSE:BAC) rose 3 percent after the company topped Wall Street earnings expectations, helped by lower legal costs. Bank of America tuned in a profit of $5.32 billion, or 45 cents a share, on revenue of $22.35 billion, compared with a profit of $2.29 billion, or 19 cents a share, on sales of $21.96 billion in the same period a year earlier.

Ahead on the earnings calendar, Intel Corporation (NASDAQ:INTC) and Netflix Inc. (NASDAQ:NFLX) are scheduled to post quarterly results Wednesday after the closing bell.