U.S. stocks rose on Tuesday after data from an industry group showed that consumer confidence rose in May, boosting optimism that the recession may be abating, and a broker upgrade of Apple Inc lifted technology stocks.

U.S. consumer confidence soared in May to its highest level in eight months, according to the Conference Board, as severe strains in the labor market showed some signs of easing, though Americans' mood remained depressed by historical standards.

Huge number -- much higher than expected, obviously giving the market a good boost here, said Todd Clark, managing director of stock trading at Nollenberger Capital Partners in San Francisco.

The extent of that could help consumer spending and economic growth in general. It's a good thing, he said.

The Dow Jones industrial average <.DJI> gained 161.69 points, or 1.95 percent, to 8,439.01. The Standard & Poor's 500 Index <.SPX> added 16.70 points, or 1.88 percent, to 903.70. The Nasdaq Composite Index <.IXIC> jumped 44.18 points, or 2.61 percent, to 1,736.19.

Apple Inc shares surged 5.2 percent to $128.84 and was the top boost on the Nasdaq after Morgan Stanley upgraded the iPhone maker to overweight, saying the company is emerging as the clear leader in the battle over mobile Internet and will see iPhone-driven earnings growth over the next two years.

The stronger-than-expected consumer confidence data helped erase Wall Street's initial declines, as recent missile tests by North Korea unsettled investors.

North Korea, despite international condemnation of its latest nuclear test, fired two more short-range missiles off its east coast on Tuesday and accused the U.S. of plotting against its government.

General Electric Co shares rose 2.1 percent to $13.38 despite comments from Chief Executive Jeff Immelt that the company's growth will be harder to come by in coming years given the prospect the global economy may grow at a slower pace once it emerges from the recession.

Also on the economic front, prices of single-family homes in March fell 18.7 percent from a year earlier, but the pace of decline slowed for a second consecutive month, according to the Standard & Poor's/Case-Shiller Home Price Indicies released on Tuesday.

Investors will also keep a close eye on the fixed income front. The U.S. Treasury sells $40 billion of two-year notes on Tuesday, $35 billion of five-year debt on Wednesday and $26 billion of seven-year paper on Thursday, matching a record for weekly bond sales set in April.

Since reaching a bear-market low on March 9, the Dow has gained nearly 29 percent and the S&P 500 has risen more than 33 percent.

(Reporting by Chuck Mikolajczak; Editing by Padraic Cassidy)