Stocks climbed more than 2 percent on Tuesday as data showing the biggest monthly jump in consumer confidence in six years lifted hopes of an economic rebound, and a brokerage upgrade of Apple Inc drove sharp gains on the Nasdaq.

Apple's shares closed nearly 7 percent higher after Morgan Stanley said the iPhone will drive strong earnings growth over the next two years and raised its price target on the stock.

An index of U.S. consumer confidence surged in May, strongly topping expectations as it registered the biggest monthly jump since April 2003, according to the Conference Board, an industry group.

Consumer discretionary shares were among the top gainers on the Dow and S&P 500, with McDonald's Corp up 3.1 percent, retailer Macy's Inc up 5.9 percent and the S&P consumer discretionary index <.GSPD> up 3.8 percent.

Today the market is celebrating the return of some sign of consumer confidence, said Peter Kenny, managing director at Knight Equity Markets in Jersey City, New Jersey. It was so strong, even the dismal housing numbers couldn't bring the market down.

The news influenced the broad market, but consumer discretionary, restaurants and even Apple shares received the biggest boost, he said. It's all the same script, Kenny said.

Other data on Tuesday showed prices of single-family homes fell in March from a year earlier. The pace of decline, however, slowed for a second consecutive month.

The Dow Jones industrial average <.DJI> rose 196.17 points, or 2.37 percent, to finish at 8,473.49. The Standard & Poor's 500 Index <.SPX> was up 23.33 points, or 2.63 percent, at 910.33. The Nasdaq Composite Index <.IXIC> was up 58.42 points, or 3.45 percent, at 1,750.43.

Consumer spending accounts for roughly two-thirds of the U.S. economy. The U.S. confidence data followed similarly rosy consumer reports in Germany and France.

The data also seemed to outweigh geopolitical concerns over North Korea's latest nuclear and missile tests [ID:nSEO205060], which pressured stocks at the open.

The market's gains came after four straight days of losses that marked the Dow's longest losing streak since the five days ended March 3. Worries about a possible cut to the United States' credit rating on Friday had pressured stocks.

On the Nasdaq, Apple shares gained 6.8 percent to close at $130.78. On the New York Stock Exchange, McDonald's shares were up 3.1 percent at $58.84 and Macy's shares were up 5.9 percent at $11.85.

Shares of General Motors Corp closed up a penny at $1.44 after news the automaker had failed to persuade bondholders to accept a debt-for-equity offer, setting the stage for the largest-ever U.S. industrial bankruptcy within days.

Homebuilder DR Horton's shares rose 5.1 percent to $9.47.

Trading was active on the New York Stock Exchange, with about 1.38 billion shares changing hands, below last year's estimated daily average of 1.49 billion, while on Nasdaq, about 2.11 billion shares traded, below last year's daily average of 2.28 billion.

Advancing stocks outnumbered declining ones on the NYSE by 5 to 1 while advancers beat decliners on the Nasdaq by about 7 to 2.

(Editing by Leslie Adler)