Stocks climbed on Tuesday, briefly hitting 2009 highs after strong housing and consumer confidence data, while Ben Bernanke's renomination as Fed chairman ended uncertainty about the central bank's leadership as the economy recovers.

Consumer confidence increased more than expected in August, the Conference Board said, while the S&P/Case-Shiller home price index rose in June for a second straight month.

A rebound in home prices and increased consumer spending are considered crucial in order for the U.S. economy to bounce back from its worst recession in decades.

Home builders' shares ranked among the top performers, with Lennar Corp up 5.4 percent at $15.36 and KB Home up 5.2 percent at $18.41. The Dow Jones US Home Construction index <.DJUSHB> rose 4.5 percent.

It suggests that there still more consumers and investors yet to turn or who are maybe increasingly turning positive and that is helping to boost the markets, said Jeff Kleintop, chief market strategist at LPL Financial in Boston.

The consumer confidence data helped drive retail stocks higher. Solid earnings from women's clothing retailer Chico's FAS Inc , up 7.8 percent at $12.82, and close-out retailer Big-Lots Inc , up 7.8 percent at $25.91, also bolstered that sector.

The S&P Retail Index <.RLX> gained 2 percent.

The Dow Jones industrial average <.DJI> gained 51.17 points, or 0.54 percent, to 9,560.45. The Standard & Poor's 500 Index <.SPX> rose 5.15 points, or 0.50 percent, to 1,030.72. The Nasdaq Composite Index <.IXIC> added 9.41 points, or 0.47 percent, to 2,027.39.

U.S. President Barack Obama's renomination of Ben Bernanke to a second term as Federal Reserve chairman reassured investors, providing continuity when the economy is showing signs of recovering from the recession.

The alternatives were not good and the choice of Bernanke is very deserved, said Hugh Johnson, chief investment officer of Johnson Illington Advisors in Albany, New York.

To some, it was expected. But there is still a sense of relief that it actually happened.

In other economic news, official forecasts said the U.S. national debt will nearly double over the next 10 years. The market's reaction was muted.

The broad S&P 500 index briefly hit a 10-month intraday high, and remains on track for its sixth straight monthly gain.

(Editing by Jan Paschal)