U.S. stocks rose on Wednesday, snapping a five-day sell-off as a jump in the price of oil and other commodities spurred energy and natural resource stocks.

Investor optimism was also buoyed by news out of China suggesting the world's third-largest economy may be on the brink of a recovery.

A day after Wall Street sank to 12-year lows, investors welcomed news that China will increase spending in areas such as infrastructure and manufacturing under a second stimulus package. But a slide in General Electric shares tempered some of the optimism.

This was started by the idea that there would be a second Chinese stimulus announced tomorrow, said Kevin Kruszenski, head of listed trading of KeyBanc Capital Markets in Cleveland.

The Dow Jones industrial average rose 135.16 points, or 2.01 percent, to 6,861.18. The Standard & Poor's 500 Index added 15.66 points, or 2.25 percent, to 711.99. The Nasdaq Composite Index climbed 33.67 points, or 2.55 percent, to 1,354.68.

Oil prices in New York rose 7.6 percent to $44.82 a barrel, lifting shares of Exxon Mobil 2.1 percent to $65.67, while miner Freeport-McMoRan Copper & Gold Inc 14 percent to $32.40.

Shares of Caterpillar Inc , a big exporter to China and a major seller of equipment to the mining industry, rose 13.7 percent to $25.55.

But a sharp slide in the shares of General Electric fueled caution as investors worried about the health of its financial arm and banks in general. The stock fell 6 percent to $6.59, making it the biggest drag on the Dow.

On Nasdaq, Apple was the top boost with a gain of 3.7 percent to $91.66, while Intel Corp rose 5.6 percent to $12.97.

(Additional reporting by Deepa Seetharaman; Editing by James Dalgleish)