Stocks rose on Tuesday to 2009 highs after stronger manufacturing and retail sales data boosted commodity prices and shares of materials companies.

Tuesday's gains lifted the S&P 500 above the 1,050 level for the first time since early October.

The improvement in retail sales in August reassured investors about a rebound in U.S. economic demand. A rise in the government's Producer Price Index signaled increased consumption of raw materials.

Metals prices rose, sending shares of aluminum company Alcoa up 8.1 percent to $13.99, while steelmaker AK Steel rose 5.7 percent to $23.11 and US Steel gained 4.8 percent to $48.98.

The Reuters-Jefferies CRB index of commodity prices <.CRB> jumped 2.2 percent for its biggest gain in more than a month, while the S&P materials sector <.GSPM> added 2.3 percent.

The rise in producer prices and a report showing stronger New York state manufacturing suggested demand is building for raw materials.

To make things, you need stuff that comes from the ground, at least at the beginning of a recovery from recession, said Kim Caughey, senior equity research analyst at Fort Pitt Capital Group in Pittsburgh.

The Dow Jones industrial average <.DJI> rose 56.61 points, or 0.59 percent, to close at 9,683.41. The Standard & Poor's 500 Index <.SPX> gained 3.29 points, or 0.31 percent, to 1,052.63. The Nasdaq Composite Index <.IXIC> added 10.86 points, or 0.52 percent, to 2,102.64.

Comments by Federal Reserve Chairman Ben Bernanke that the recession was probably at an end also favored basic materials companies, Caughey said.

Bernanke, speaking on the one-year anniversary of the collapse of Lehman Brothers , said the recession is very likely over.

A stronger-than-expected rise in retail sales notwithstanding, shares of retailers got hit by disappointing results from Best Buy Co Inc and Kroger Co , both of which reported quarterly profits below expectations.

Shares of electronics store Best Buy fell 5.2 percent to $38.32 while grocer Kroger slid 7.5 percent to $20.46. The S&P Retail index <.RLX> was down 0.14 percent.

Shares of General Electric jumped 4.2 percent to $16, helped by an upwardly revised price target from Bernstein Research.

The conglomerate's sharp rebound -- of about 140 percent from its 2009 closing low -- could be a harbinger of more gains for the broader stock market in the months ahead, said Richard Ross, global technical strategist at Auerbach Grayson.

After the closing bell, Adobe Systems Inc announced a $1.8 billion deal to buy business software maker Omniture Inc in an effort to counter falling sales from its Photoshop and Acrobat programs.

Adobe shares fell 3.8 percent to $34.25 in extended trading, while Omniture jumped more than 25 percent to $21.75 on the Nasdaq.

The Nasdaq got a boost after analysts' upgrades of Web auctioneer eBay and Internet company Yahoo . Yahoo shares climbed 5.4 percent to $16.41 while eBay added 1.3 percent to $24.14.

Volume was near average on the New York Stock Exchange, with 1.5 billion shares changing hands, in line with last year's estimated daily average of 1.49 billion. On the Nasdaq about 2.4 billion shares traded, above last year's daily average of 2.28 billion.

Advancing stocks outnumbered declining ones on the NYSE by a ratio of about 12 to 5, while on the Nasdaq, about 7 stocks rose for every 5 that fell.

(Additional reporting by Ellis Mnyandu; Editing by Kenneth Barry)