* Markit manufacturing data ahead of expectations
* Tesla shares soar after results, Wal-Mart falls
* Facebook shares drop; will buy WhatsApp for $19 bln
* Data from China weak, Ukraine turmoil continues
* Indexes up: Dow 0.2 pct, S&P 0.1 pct, Nasdaq 0.1 pct
NEW YORK, Feb 20 (Reuters) - U.S. stocks edged higher in volatile trading on Thursday, as a strong read on manufacturing offset weak results from Wal-Mart and geopolitical and economic uncertainty around the world.
Major indexes swung between slight gains and slight losses, indicating markets lacked direction a day after the S&P 500's biggest daily decline in more than two weeks.
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.
Investors have largely shrugged off tepid data, pinning recent weakness to the impact of unexpectedly cold weather rather than worsening fundamentals.
However, stocks fell on Wednesday after comments from the Federal Reserve failed to reinforce the central bank's commitment to stimulating the economy despite the recent weakness.
"The manufacturing data is extremely positive, especially coming after a spate of bad news at a time when the Fed seems committed to slowing stimulus," said Nicholas Colas, chief market strategist at the ConvergEx Group in New York.
Wal-Mart Stores Inc was the Dow's bigger decliner, falling 2.4 percent to $73.07 after the world's biggest retailer reported a drop in U.S. same-store sales and gave an earnings outlook below expectations.
Social networking giant Facebook said late Wednesday it would buy mobile-messaging startup WhatsApp for $16 billion in cash and stock, plus an additional $3 billion worth of restricted stock units to WhatsApp's founders. Shares fell 3.3 percent to $65.83 in heavy trading.
On the upside, Tesla surged 9.5 percent to an all-time high of $212.04 a day after it reported fourth-quarter results that topped expectations and said deliveries of its luxury Model S electric sedan would surge more than 55 percent this year.
The Dow Jones industrial average was up 26.33 points, or 0.16 percent, at 16,066.89. The Standard & Poor's 500 Index was up 2.02 points, or 0.11 percent, at 1,830.77. The Nasdaq Composite Index was up 3.95 points, or 0.09 percent, at 4,241.91.
In other data, jobless claims fell less than expected in the latest week, while consumer prices rose 0.1 percent in January, as expected. Separately, factory activity in the U.S. mid-Atlantic region unexpectedly contracted in February, according to the Philadelphia Federal Reserve Bank's business activity index.
Turmoil in emerging markets continued, with Ukraine experiencing some of its worst violence since the end of the Cold War. The country's hryvnia currency dropped to near five-year lows, while the country's state debt insurance costs rose to their highest since December 2009.
Emerging market growth was also in view after China's flash Markit/HSBC Purchasing Managers' Index fell to a seven-month low in February, falling under the level that represents expansion.
"The market's strength is somewhat surprising given how weak overseas markets have been," said Colas. "It is good to see investors buying on dips, but I've also been hearing a lot more bearish chatter."
Quanta Services Inc jumped 7.4 percent to $34.47 as the S&P's biggest percentage gainer after reporting its fourth-quarter results.
Safeway Inc rose 5.4 percent to $36.46 a day after the supermarket chain said it was in talks about possibly selling itself. The company also reported its fourth-quarter results.