Stocks gained on Tuesday as a weak dollar lifted commodity prices and home sales data reassured investors about the state of the housing market, considered one of the biggest drags on a recovery.

Sentiment also improved as concerns receded about the impact of Dubai's debt woes, which some had feared could lead to another global crisis.

The U.S. dollar index <.DXY> fell 0.7 percent against a basket of currencies as waning anxiety about Dubai limited the greenback's safe-haven appeal.

The initial shock over Dubai prompted a flight to quality, said Dan Faretta, senior market strategist at Lind-Waldock in Chicago. Suddenly Dubai isn't a big fear, and that relief is pushing the dollar down. That's why we're seeing the market rally.

Crude oil futures gained 1.8 percent while the S&P Energy Index <.GSPE> advanced 1.8 percent. The Materials Index <.GSPM> surged 2.1 percent.

Pending sales of previously owned U.S. homes rose more than expected in October, reassuring investors about the state of the troubled sector.

Sales advanced to their highest level in 3-1/2 years, according to data from the National Association of Realtors, sending the Dow Jones home construction index <.DJUSHB> up 1.8 percent.

The Dow Jones industrial average <.DJI> rose 128.17 points, or 1.24 percent, to 10,473.01. The Standard & Poor's 500 Index <.SPX> gained 13.06 points, or 1.19 percent, to 1,108.69. The Nasdaq Composite Index <.IXIC> climbed 32.67 points, or 1.52 percent, to 2,177.27.

Construction spending was flat in October, above the expectation for it to slide in the month. In addition, the Institute for Supply Management said that the manufacturing sector expanded in November, though the expansion was less than expected.

Staples Inc jumped 6.4 percent to $24.82 after it reported adjusted third-quarter earnings that beat expectations and forecast sales growth in its fourth quarter.

Shares of troubled insurer American International Group Inc surged 11 percent to $31.55 after it closed a pact with the New York Federal Reserve Bank that slashes its debt under a credit facility by more than half.

The benchmark S&P 500 is up 63.9 percent from its 12-year closing low on March 9.

(Editing by Jan Paschal)