Stocks rebounded from four days of losses, buoyed by a recovery in technology shares, an easing of concerns about credit losses at major banks and optimism over Wal-Mart Stores' solid profit.
A sharp slide in crude oil prices below $92 a barrelalso underpinned the market, easing worries about higher energy costs heading into winter and the holiday shopping season.
In the last hour of trading, stocks also got a boost from a report that showed a surprising rise in September pending home sales.
"The market is extremely oversold. We like technology," said David Levy, portfolio manager of Kenjol Capital Management in Austin, Texas. "Today you have leadership from the likes of Bank of America, Goldman and JPMorgan, all saying maybe things aren't as bad as everybody says it's going to be."
The Dow Jones Industrial Average was up 2.46 percent, the Standard & Poor's 500 Index was up 2.91 percent, and the Nasdaq Composite Index was up 3.46 percent. The Dow had its second 300+ point gain of 2007 and also its second-best point and percentage gain this year.
Apple sparked the tech sector as it disclosed talks with China Mobile to bring the iPhone to China, while investors also greeted a downturn in oil and bonds as reason to intensify buying.
The Nasdaq's second-biggest advancer was BlackBerry maker Research In Motion , whose stock gained more than 9 percent.
"I love tech. I think it's the place to be. Nothing is safe these days, but technology is safer than the financials," said Harry Clark, president of Clark Capital Management Group in Philadelphia. "Wal-Mart was a good surprise. It shows that the consumer is still alive and kicking."
Financials rallied on the back of comments from Goldman Sachs Chief Executive Lloyd Blankfein, who said at a conference Tuesday that the investment bank expected no significant asset write-downs.
The stock rally picked up speed in the final hour after a report showed pending home sales rose unexpectedly in September.
The housing data, which was released at 3 pm, showed pending home sales rose 0.2% in September from the month before but were still down 20.4% from a year ago.
The report added to investors' optimism and bolstered a broader advance as technology shares rebounded, while shares of financial services companies soared as worries about credit losses at big banks abated.
Wal-Mart Shows Strength
In other corporate developments, Wal-Mart's third-quarter profit came in at 70 cents against market estimates of 67 cents, while sales at stores open at least one year were up 1.5 percent.
"The fact is the company's getting it back together," Robert Doll, BlackRock vice chairman, said on this morning's "Squawk Box." "They had a period where they were struggling, pushing took hard on some of the folks who were taking their products, and I think they've come back to a point where they can get back on a growth track."
Wal-Mart began the surge with a strong earnings report and was followed by Citigroup and Countrywide, both of which reported changes in corporate practices related to their credit businesses.
Still, skepticism abounded that the gains were not sustainable and a market correction would resume.
"Today is a reaction to a very oversold situation we've seen over the past four days or so," said Jay Wong, portfolio manager at Los Angeles-based money manager Payden & Rygel. "It's not unusual after a few days of a drop like this to have a little bit of a rebound."
But Wong said the fundamentals of retail are still weak and doubted whether Wal-Mart's results would change the sector overall.
Home Depot said sales were hit by the housing market downturn, with consumers putting off plans to redecorate and improve their homes.
Elsewhere in the retail sector, TJX , owner of the T.J. Maxx and Marshalls chains, reported earnings in line with estimates. TJX shares rose, as did those at big box retailers Costco and Target.
Oil, Dollar Slip
Oil fell after the International Energy Agency (IEA) cut its forecast for world oil demand growth, saying that the recent surge in oil prices had already hurt consumption.
The dollar slipped against most currencies Tuesday, resuming a long-term decline after a brief respite on Monday as investors expected further signs of housing weakness and sluggish consumer spending that could hurt U.S. growth.
Gold bounced back to trade above $800 after hitting a one-week low in Asian trade, as bargain-hunters resurfaced and a weaker dollar helped the metal.
But analysts said the metal remained vulnerable to further corrections because of a decline in oil prices and profit-taking from last week's rally that saw the metal hitting a 28-year high of $845.40 and hovering near its record peak of $850.
Treasurys fell as investors bought into higher-risk investments like stocks after Wal-Mart posted its earnings.