Stocks snapped a three-day slide on Monday as signs that Federal Reserve Chairman Ben Bernanke would win a U.S. Senate vote for a second term helped ease investors' concerns.

After the closing bell, iPod maker Apple Inc reported sharp gains in quarterly revenue and profit, sending its shares 1.9 percent higher to $207.00 in after-hours trading. The company also said it moved to adopt new accounting standards for its iPhone.

It looks like they are still picking up market share, said Keith Springer, president of Capital Financial Advisory Services in Sacramento, California.

Chipmaker Texas Instruments posted its fourth-quarter results and outlook for the first quarter after the close. Its stock shed 1.2 percent to $23.40.

U.S. lawmakers looked likely to approve Bernanke's nomination after the White House defended his record fighting the financial crisis in an effort to rally votes.

(Bernanke) is clearly what prompted it, said Stephen Massocca, managing director at Wedbush Morgan in San Francisco, referring to the stock market's recovery. Coupled with the fact we were 600 points down in a straight line, we were due for a bounce.

Massocca said private counts of Bernanke's support showed well more than a majority of senators would vote for confirmation.

The Dow Jones industrial average <.DJI> gained 23.88 points, or 0.23 percent, to 10,196.86. The Standard & Poor's 500 Index <.SPX> gained 5.02 points, or 0.46 percent, to 1,096.78. The Nasdaq Composite Index <.IXIC> gained 5.51 points, or 0.25 percent, to 2,210.80.

IBM climbed 0.5 percent to $126.12 while Hewlett-Packard Co added 1.6 percent to $50.06 and were among the top performers on the Dow. The PHLX Semiconductor index <.SOXX> gained 1.4 percent.

Both the Dow and Nasdaq briefly turned negative after data from the National Association of Realtors showed sales of previously owned U.S. homes fell at a record pace in December, highlighting the housing market's reliance on government aid.

Homebuilder Toll Brothers Inc shed 0.7 percent to $18.15.

Shares of natural resource companies rebounded, lifting the S&P materials index <.GSPM> up 0.8 percent. AK Steel Holding Corp jumped 5.4 percent to $21.27 after the company posted a fourth-quarter profit and forecast higher prices as demand shows signs of growth.

On the New York Stock Exchange, about 1.05 billion shares changed hands, below last year's estimated daily average of 2.18 billion. On the Nasdaq, about 2.18 billion shares traded, above last year's daily average of 1.63 billion.

Advancing stocks outnumbered declining ones on the NYSE by a ratio of 4 to 3, while the ratio on the Nasdaq was about even.

(Additional reporting by Leah Schnurr; Editing by Kenneth Barry)