Wall Street on Monday cheered the apparent defeat of a Mexican leftist presidential candidate whose spending promises raised debt fears, but a looming vote dispute and a longer-term political crisis may ruin the party.

Conservative candidate Felipe Calderon declared victory on Monday after Sunday's hotly contested election, and official returns appeared to show that leftist favorite Andres Manuel Lopez Obrador could not catch him.

The market thought that Lopez Obrador was going to win, said Benito Berber, an economist at HSBC Securities. Suddenly we're in a position where it seems that Calderon is going to be the next president.

Lopez Obrador had wooed many of Mexico's poor with handouts to the elderly, disabled and single mothers while mayor of Mexico City, and promised a greater state role in the economy.

Ruling party candidate Calderon, however, wants to continue the free-market policies of President Vicente Fox.

Investors had grudgingly priced in a Lopez Obrador win based on polls ahead of Sunday's vote, and Mexico's currency, bond prices and stocks all rallied on Monday as authorities showed Calderon ahead with most almost all votes counted.

The stock market soared 4.77 percent on Monday, its second-biggest one-day gain this year, and the peso strengthened 1.8 percent.

But with Lopez Obrador expected to contest a final result that will not come until at least Wednesday and little clue as to how millions of his poor supporters will react to having their hopes dashed, market euphoria could be short-lived.

The fact that Calderon is now the most likely winner is a positive for the market, said Alberto Bernal, an economist at Bear Stearns. The bad news is that the election will be contested, I have absolutely no doubt about it.

(Wall Street's celebrations) definitely could be short-lived, bad news could come at any point, he said. The risk remains of strikes, disruption to economic activity and violence.

TOO CLOSE TO CALL

Electoral authorities said late on Sunday that the contest was too close for the result to be based on a quick count. But both candidates claimed victory on television, a move seen exacerbating tensions that could lead to market volatility.

We see these hasty declarations as a potential risk that the election could be disputed in the electoral court or, in the worst case scenario, on the streets. Goldman Sachs said in a research report.

Lopez Obrador can challenge the final result in Mexico's electoral court, a process that could leave markets in limbo for several weeks, although most analysts say his party would need to present concrete evidence of vote fraud to do so.

The election was Mexico's first since Fox broke the Institutional Revolutionary Party's 71-year hold on power in 2000, but some say the country's democracy is mature enough to sidestep chaos.

There'll be someone breaking a window, there'll be someone yelling and screaming in front of the TV cameras, Joydeep Mukherji, sovereign ratings director at Standard & Poor's rating agency, said, arguing that serious civil unrest was unlikely.

This is not a new democracy that came out of dictatorship yesterday, he said. We're dealing here with a political leadership which although very divided, is very mature at the end of the day. They do negotiate things.

While Fox has been praised for maintaining economic stability, a deadlock in Congress has stopped him passing structural reforms economists say are vital.

While the National Action Party appeared to have increased its share of Congress on Sunday, so did Lopez Obrador's party and Calderon looks likely to inherit the same stalemate.

The nature of this victory being so close means that there's greater uncertainty over the medium term about the ability to come to agreements on these issues that are really important for Mexico, said Mukherji. I think that will be a sobering thought to the market.