In addition, investors cheered minutes from the Federal Reserve showing that while central bankers now forecast a longer impact from housing on the economy, they expected risks to growth to have "diminished slightly" after a first quarter slump.
"The main negative was they said housing will weigh on the economy for longer than anticipated," said Art Hogan, chief market strategist at Jefferies & Co. "Otherwise, it's still the same, inflation remains their number one concern."
After briefly dipping in negative territory, the Dow Jones Industrial Average rallied 111 points to close at 13,633, a new record high and closing level.
Leading the Dow were the likes of Alcoa Inc. , Boeing Co. , and Exxon Mobil Corp. .
The S&P 500 gained 12.1 points to 1,530, also a new record closing level. The Nasdaq Composite rose 20.5 points to 2,592.
The Dow earlier fell 65 points before bouncing back, as investors shrugged off a 6.5% drop in the Shanghai stock market, sparked by a tripling of taxes on stock trades.
"The overwhelming consensus is that this is a Chinese market situation and should have no impact over here," said Elliot Spar, market strategist at Ryan, Beck & Co.
Among blue chips, Caterpillar Inc. was the biggest gainer, adding 3.6% after competitor Joy Global Inc. issued an upbeat outlook for the coming 12 months. Coca Cola Co. gained 0.9% after Citigroup upgraded the stock to buy from hold.
IBM gained 1% after saying it has bought back $12.5 billion in company stock as part of a previously announced $15 billion buyback plan. IBM also said it expects its 2007 earnings to now rise between 13% and 14% over the $6.06 a share it earned last year.
Among tech shares, Apple Inc. jumped 3.9% after it launched iTunes Plus, where it will sell music from EMI's catalog without copy protection at a price of $1.29 per song.
Trading volumes showed 1.5 billion shares exchanging hands on the New York Stock Exchange and 2.0 billion trading on the Nasdaq Stock Market. Advancing issues beat decliners by 11 to 5 on the NYSE and by 16 to 13 on the Nasdaq.
Shanghai deja vu
Overnight, the Shanghai Composite stumbled 6.5% after China's stock trades tax hike led to fears that, as in February, a big drop there could lead to declines elsewhere, despite the market being virtually shut to foreign investors. There were lighter losses on bourses in Tokyo and London.
Analysts said the follow-through in New York trade from Shanghai's selloff would be limited, as the U.S. market in recent weeks has become more relaxed about developments in the booming Chinese equities market.
"This is reminiscent of what happened in late February," said George Yared of Yared Investment Research, referring to a major U.S. market correction triggered by another Shanghai selloff. "There was heavy discussion then too of making taxes on stock trades more stringent."
But "what is interesting is that we saw this game already and we were victimized before," Yared said.
Even commodity markets took the Shanghai news in stride.
Gold finished down $4.10 to close at $653.10 an ounce, amid concerns that Chinese growth and investments could wane. But the shares of metals miners were mixed, with the likes of Eldorado Gold Corp falling while some, such as Freeport McMoRan Copper and Gold advanced.
And crude futures rose 40 cents to close at $63.55 a barrel, bouncing back from a sell-off on Tuesday.
By sector, oil services , real estate investment trusts and financials led the gains, while semiconductors and pharmaceuticals were among the few areas seeing some weakness.
"The interest ting, is that this time around, we were able to separate the Shanghai stock market from the Chinese economy," said Jefferies' Hogan.
"Now the major concern is that the Chinese economy continues to grow, not the stock market. It's not the stock market that brings up demand for steel and other things that we sell to China."
Economy and markets
The latest ADP employment report suggested that jobs growth this month will come in below the 150,000 new jobs forecast by MarketWatch. The official May employment report will be released on Friday.
This news and weakness in global equities had sparked early interest in low-risk Treasurys but the bid was lost as U.S. stocks recovered. The benchmark 10-year Treasury note finished up only 1/32 at 97-1/32 with a yield of 4.884%. Overnight there were also rallies for Japanese and German bonds.
The dollar was down against the yen and up against the euro.
Futures market operator Intercontinental Exchange Inc. is continuing with its efforts to take over CBOT Holdings. According to the Wall Street Journal, ICE has reached a deal, valued at $665 million, that would settle a dispute between CBOT parent of the Chicago Board of Trade, and its rival, the Chicago Board Options Exchange.
That deal can go into effect only if ICE wins CBOT. Both ICE and the Chicago Mercantile Exchnage had bid for the CBOT, whose management factors the Chicago exchange.
The shareholder-advisory service Shareholder Institutional Services is urging Biomet Inc. shareholders to reject a $10.9 billion private-equity deal for the company, the Wall Street Journal reported.
Holders of the Warsaw, Ind., designer of artificial knees are set to vote June 8 on a bid by a group including Blackstone, Goldman Sachs, Kohlberg Kravis Roberts and TPG Capital.
Elsewhere, Cantor Fitzgerald is offering $9.75 a share for stock of eSpeed, which it plans to combine with BGC Partners.
Technology retailer CDW will be bought by buyout firm Madison Dearborn for about $7.3 billion.
By Nick Godt