Stocks rose on Tuesday as renewed U.S. dollar weakness lifted shares of oil and other natural resource companies, while a rebound in May housing starts reinforced hope that the economy could be stabilizing.

One day after Wall Street logged its worst slide in a month, investors got fresh signs that the recession could be moderating. Other data on Tuesday showed inflation remained contained after May producer prices rose less than expected.

Among natural resource stocks rising on the back of resurgent commodity prices, aluminum producer Alcoa Inc , gained 1.3 percent to $11.36, while U.S. Steel Corp rose 2.7 percent to $38.10.

ConocoPhillips climbed 1.5 percent to $43.74 as U.S. front-month crude rose $1.35, or 1.9 percent, to $71.97 a barrel.

One surprise here is the continuation of crude where every fundamental analyst continues to think it's overpriced yet we've recovered all the losses from yesterday, said Steve Goldman, market strategist at Weeden & Co. in Greenwich, Connecticut. One wonders if that is a proxy for growth in the future.

The Dow Jones industrial average <.DJI> gained 4.84 points, or 0.06 percent, to 8,616.97. The Standard & Poor's 500 Index <.SPX> gained 2.23 points, or 0.24 percent, to 925.95. The Nasdaq Composite Index <.IXIC> rose 10.04 points, or 0.55 percent, to 1,826.42.

Shares of Caterpillar Inc , a maker of excavators and bulldozers used in mining and construction, were up 1.2 percent to $36.55.

Among housing stocks, Toll Brothers jumped 3.2 percent to $17.82, while the Dow Jones home construction index <.DJUSHB> added 3 percent.

Even so, there was some caution after Best Buy Co Inc , the largest U.S. consumer electronics retailer, posted a slide in same-store sales, a key measure of retail performance, overshadowing a quarterly profit that came in above analysts' estimates.

Best Buy shares dropped 5.5 percent to $36.54.

While the run-up in commodity prices helps underpin stocks, it also raises concern that surging oil and other commodities may hamper any budding economic recovery in the long run. Higher energy costs are a drag on consumer spending and corporate profits.

The broad S&P 500 is still up 37 percent from the 12-year closing low of March 9.

(Additional reporting by Chuck Mikolajczak; Editing by Padraic Cassidy)