Stocks rose on Wednesday as investors jumped back into the market following a five-day sell-off that drove Wall Street to 12-year lows, while soaring prices of oil and other commodities lifted energy and natural resource shares.

Investor optimism was also buoyed by news that China will increase spending in areas such as infrastructure and manufacturing under a second stimulus package. Data suggested that China's economy may also be on the brink of a recovery.

Shares of Caterpillar Inc , a big exporter to China and a major seller of equipment to the mining industry, rose more than 13 percent. Mining equipment maker Joy Global Inc posted a higher-than-expected quarterly profit and backed its 2009 outlook, sending its stock up almost 10 percent.

The market is encouraged by the news from China, said Joe Arsenio, president of Arsenio Capital Management in Larkspur, California. They believe (China) will gain traction in the second quarter.

The Dow Jones industrial average <.DJI> gained 112.38 points, or 1.67 percent, to 6,838.40. The Standard & Poor's 500 Index <.SPX> rose 11.00 points, or 1.58 percent, to 707.33. The Nasdaq Composite Index <.IXIC> added 26.61 points, or 2.01 percent, to 1,347.62.

But General Electric bucked the trend, falling 9.8 percent to $6.31, as investors worried about the health of its financial arm and banks in general.

Oil prices in New York rose 6.4 percent to $44.30 a barrel, while the Reuters-Jefferies CRB <.CRB> index of 19 commodity futures rose 3.1 percent. Shares of Exxon Mobil rose 1.9 percent to $65.59, while miner Freeport-McMoRan Copper & Gold Inc jumped nearly 13 percent to $32.05.

The reallocation of assets from China is also improving the outlook for commodities, Arsenio added.

The S&P energy index <.GSPE> rose 3.6 percent.

On Nasdaq, Apple was the top boost with a gain of 3.3 percent to $91.32, while Intel Corp rose 4.4 percent to $12.82.

The rise in big-cap technology stocks also underpinned gains in chip makers' shares, pushing the semiconductor index <.SOXX> up 4.2 percent. Broadcom Corp added 4.9 percent to $16.57.

(Editing by Jan Paschal)