Stocks eke out gains after Bernanke speech; Yahoo spikes 10%

Stocks squeezed out modest gains in choppy trading Wednesday, following comments from Fed Chairman Ben Bernanke that monetary policy will remain highly accommodative even as the central bank could start to scale back its bond buying later this year.

"U.S. equities have recouped their Spring swoon as a litany of Fed governors' pronouncements have on balance calmed fears QE tapering might begin before the U.S. recovery is strong enough to handle it," according to Alec Young, global equity strategist at S&P Capital IQ. "This more dovish Fed perception, coupled with a recent softening in economic news flow has hit bond yields and the greenback, while emerging market stocks have finally caught a bid—outperforming the S&P by 2.6 percent since July 10—as carry trade unwinding has eased. Turning back to the U.S., second-quarter beats will now need to take the lead in fueling stocks, as we think a more dovish Fed is now priced into a very overbought market."

The S&P 500 rose 4.65 points to end at 1,680.91. And the Nasdaq added 11.50 points to finish at 3,610. The CBOE Volatility Index (VIX), widely considered the best gauge of fear in the market, ended below 14.

Most key S&P sectors ended in positive territory, led by materials, while utilities lagged.

Art Cashin: Where's the Bernanke bounce?

CNBC's Bob Pisani and Art Cashin, of UBS, today on Capitol Hill will be enough to spark a "mild" rally.

In his statement, Bernanke reiterated the central bank's plan to start paring back its bond-purchase program later this year, but said that could change if the economic outlook shifted.

"Our asset purchases depend on economic and financial developments, but they are by no means on a preset course," according to Bernanke's prepared remarks to the U.S. House of Representatives Financial Services Committee.

Bernanke said the pace of asset purchases could be reduced "somewhat more quickly" if economic conditions were to improve faster than expected. On the other hand, the current $85 billion monthly pace "could be maintained for longer" if the labor market outlook darkened, or inflation did not look like it was rising back toward the Fed's 2 percent goal.

On the economic front, housing starts tumbled 9.9 percent in June to a seasonally adjusted annual rate of 836,000 units, according to the Commerce Department, the lowest level since last August. Economists polled by Reuters had expected groundbreaking to rise to a 959,000-unit rate last month.

Mortgage applications fell last week, due to a decline in demand for refinancing loans as mortgage interest rates remained at a two-year high, according to the Mortgage Bankers Association.

Yahoo surged nearly 10 percent to hit a five-year high after the Internet company beat earnings expectations, though revenue and current-quarter guidance fell short of forecasts. Still, at least seven brokerages lifted their price target on the company.

St. Jude soared after the medical equipment company exceeded quarterly expectations and raised the lower end of its full-year earnings forecast. The company also said sales would gain momentum this year as it rolls out a series of new heart devices.

Analysts expect S&P 500 companies' second-quarter earnings to have grown 3 percent from a year earlier, with revenue up 1.5 percent, according to the latest data from Thomson Reuters.