Stocks climbed on Thursday after a reading on manufacturing activity hit its highest in nearly four years, while news about Facebook and Tesla drove their shares to record highs.
The major indexes swung between slight gains and losses in early trading, but were clearly in the black after noon and didn't look back. The S&P 500 ended less than 0.5 percent below its record close set last month at 1,848.38.
U.S. factory activity accelerated at its fastest pace in nearly four years in February, according to Markit's preliminary U.S. Manufacturing Purchasing Managers Index, a bullish economic indicator following a string of weaker-than-expected reports.
New claims for unemployment insurance fell in the latest week, boding well for the job market, but the Philadelphia Fed's gauge of manufacturing activity unexpectedly contracted in February.
The stock market has selectively shrugged off tepid data, pinning recent weakness on the impact of extremely cold weather and massive snow rather than worsening fundamentals.
"The U.S. (Markit) PMI number was probably not as good as it seems. There could be some noise there, but it certainly is a good number," said Paul Zemsky, head of asset allocation at ING Investment Management in New York.
"Overall, I think the data is a little equity positive. I don't think this is sufficient to take us past 1,850 (on the S&P 500). We need a reasonably good jobs number for that. I think we still coil here for a few sessions, but we'll break to new highs because the economy is going to show the slowdown was weather-related."
The Dow Jones industrial average .DJI rose 92.67 points or 0.58 percent, to end at 16,133.23. The S&P 500 .SPX gained 11.03 points or 0.60 percent, to finish at 1,839.78. The Nasdaq Composite .IXIC added 29.591 points or 0.7 percent, to close at 4,267.545.
Social networking giant Facebook (FB.O) said late Wednesday it would buy mobile-messaging startup WhatsApp for $16 billion in cash and stock, plus $3 billion worth of restricted stock units to WhatsApp's founders. Facebook shares initially fell on the news, but closed up 2.3 percent at $69.63 after earlier hitting a record high of $70.11.
Tesla (TSLA.O) shares surged 8.4 percent to $209.97 after hitting an intraday record of $215.21. The electric car maker reported fourth-quarter results that topped expectations on Wednesday after the closing bell and said deliveries of its luxury sedan would surge more than 55 percent this year.
The market disregarded rising political tensions and violence from Caracas to Kiev, though concerns may increase next week as earnings wind down and the data calendar thins further.
Emerging market growth was also in view after China's flash Markit/HSBC Purchasing Managers' Index fell to a seven-month low in February.
"The market's strength is somewhat surprising, given how weak overseas markets have been," said Nicholas Colas, chief market strategist at the ConvergEx Group in New York.
"It is good to see investors buying on dips, but I've also been hearing a lot more bearish chatter."
DirecTV (DTV.O) shares rose 2.9 percent to $75.08, dipping from a record high of $75.50 hit earlier in the session, after the largest U.S. satellite TV company reported fourth-quarter results above analysts' estimates and authorized a $3.5 billion stock-buyback program.
On the downside, Wal-Mart Stores Inc (WMT.N) fell 1.8 percent to $73.52 after the world's biggest retailer reported a drop in U.S. same-store sales and gave an earnings outlook below expectations.
About 6.4 billion shares traded on U.S. exchanges, according to the latest available data from BATS Global Markets, below the 7.05 billion average so far in February.
Advancing issues outnumbered declining ones on the New York Stock Exchange by a ratio of slightly less than 2 to 1. On the Nasdaq, about 12 stocks rose for every five that fell.