* Surprise contraction in U.S. factory sector dents markets
* Euro slides as euphoria ebbs over debt crisis deal
* Weak European and Asian data also weighs
By Herbert Lash and Leah Schnurr
NEW YORK, July 2 (Reuters) - Stocks finished higher on M onday as weak U.S. manufacturing data raised speculation the Federal Reserve will again step in to boost the economy, though worries the global economy is deteriorating took the euro and oil lower.
Manufacturing sectors in the United States, the euro zone, China and Brazil all shrank last month as factories felt the impact of Europe's debt crisis.
The U.S. data from the Institute for Supply Management initially took Wall Street lower. But stocks held their ground and the S&P 500 and Nasdaq ended the day up slightly.
Analysts said the weak data raised the odds the Federal Reserve will undertake a third round of bond buying, known as quantitative easing, or QE3, to prop up the economy.
"The ISM reading was pretty weak, but it is pretty positive that the market had an excuse to sell off and instead we're resilient," said Mike Gibbs, chief market strategist at Morgan Keegan in Memphis, Tennessee.
"This gives investors a little more confidence that QE3 may be in the cards at some point. "
The Dow Jones industrial average dipped 8.70 points, or 0.07 percent, to 12,871.39. The Standard & Poor's 500 Index gained 3.35 points, or 0.25 percent, to 1,365.51. The Nasdaq Composite Index rose 16.18 points, or 0.55 percent, to 2,951.23.
European equities ended at a two-month closing high on investor anticipation of further action after the European Union agreed on Fr iday to measures to cut soaring borrowing costs in Italy and Spain, while directly recapitalizing regional banks.
The pan-European FTSEurofirst 300 index closed 1.4 percent higher at 1,035.32.
The economic data also drove the euro lower against the dollar, while the greenback fell against the yen.
Oil prices fell more than 1 percent on concerns the world economy was weakening more quickly than anticipated and safe-haven bonds rose.
The U.S. ISM report marked the first time since July 2009 that the index has fallen below the 50 level that separates expansion from contraction.
"This is clearly very, very troubling," said Hugh Johnson, chief investment officer of Hugh Johnson Advisors LLC in Albany, New York. "It indicates that at least in the month of June, the manufacturing sector of the economy contracted and there is meaningful evidence of, at a minimum, disinflation," he said.
The euro fell after Finland and the Netherlands opposed a plan for the euro zone's permanent bailout fund to buy government bonds in the secondary market, casting doubt on the deal announced Friday to keep Spain and Italy from falling deeper into the debt and banking crisis.
Brad Bechtel, managing director at Faros Trading in Stamford, Connecticut, warned that the negative news headlines out of Europe are likely to persist, keeping uncertainty levels high and markets jittery. This kind of situation "as always, will make things even worse," he said.
The euro was last trading at $1.2585.
The weak ISM reading sets the stage for a soft June U.S. nonfarm payrolls report on Friday and further stimulus from the Fed, said Joe Manimbo, a market analyst at Western Union Business Solutions in Washington.
"On the surface, it can increase the chance that we could see QE3 this year, so that can certainly cap the dollar's upside," Manimbo said.
Spanish bond yields rose as euphoria over the euro zone deal to stabilize debt markets ebbed on concern over potential implementation hurdles and the uncertain global growth outlook.
Spanish 10-year government bond yields reversed earlier falls to end higher.
U.S. Treasury debt prices rose on safe-haven buying, though trading was thin ahead of the U.S. July 4th holiday on Wednesday.
The benchmark 10-year U.S. Treasury note was up 18/32 in price to yield 1.582 percent.
The manufacturing data from around the world also took oil prices lower on worries that slowing economic growth would mean less demand for the commodity.
U.S. crude futures ended a day of choppy trading down $1.21 to settle at $83.75 a barrel.