As central banks stood ready to intervene in case of financial turmoil, Greece held its second national election in six weeks after an inconclusive ballot on May 6.
With one party advocating ripping up Greece's multibillion-euro bailout deal, the election was seen as a vote on whether Greece should stay in the 17-nation joint euro currency. A Greek exit would have had potentially catastrophic consequences for other ailing European nations, the United States and the entire global economy.
With 82.5 per cent of the vote counted, official results showed New Democracy winning 30 per cent and 130 of the 300 seats in Parliament. The radical anti-bailout Syriza party had 26.6 per cent and 71 seats and the pro-bailout Socialist PASOK party came in third with 12.5 per cent of the vote and 33 seats.
The anti-immigrant nationalist Golden Dawn party had 6.9 per cent and 18 seats, while the Democratic left won 6.1 per cent and 18 seats.
The parties have starkly different views about what to do about the €240 billion ($300 billion) in bailout loans that Greece has been given by international lenders, and the harsh austerity measures that previous Greek governments had to accept to get the funds.
New Democracy leader Antonis Samaras cast Sunday's choice as one between keeping the euro and returning to Greece's old currency, the drachma. He has vowed to renegotiate some of the bailout's harsher terms but insists the top priority is for the country to remain in Europe's joint currency.
"The Greek people today voted for Greece to remain on its European path and in the eurozone," Samaras said after his party won. "(Voters chose) policies that will bring jobs, growth, justice and security."
Syriza chief Alexis Tsipras, who had tapped into a vein of deep anger over the plunging living standards faced by many Greeks, had wanted to rip up Greece's international bailout deals and roll back the new taxes, job cuts and pension cuts imposed in the last two years.
That plan will have to wait, since the party that comes in first — New Democracy — gets the first stab at forming a new majority in Parliament. If they fail, the next highest party gets to try.
Tsipras congratulated Samaras and conceded the election.
The head of Greece's socialist PASOK party, meanwhile, proposed that a unity government be formed of four top parties, including Syriza despite its anti-bailout views.
PASOK's Evangelos Venizelos, who spent months negotiating bailouts as Greece's finance minister, suggested dumping the usual procedure of each party seeking coalition partners. He said a government must be formed quickly and suggested one between New Democracy, Syriza, PASOK and the small Democratic Left.
"There is not one day to lose. There is no room for party games. If we want Greece to really remain in the euro and get out of the crisis to the benefit of every Greek government, it must have a government tomorrow," Venizelos said after results were announced.
Germany's finance minister welcomed the New Democracy party's victory as a decision to "forge ahead" with implementing far-reaching reforms. Germany's foreign minister said it was important for Greece to stick to its agreements with creditors, but held out the prospect that Athens might be given more time to comply with them.
Germany — Europe's biggest economy — has been a major contributor to Greece's 2 multibillion-euro rescue packages and a key advocate of demanding tough, and highly unpopular, austerity and reform measures in exchange.
Greece has been dependent on rescue loans since May 2010, after it was locked out of the international markets following years of profligate spending and falsifying financial data. The spending cuts made in return for the bailout loans have left the country mired in a fifth year of recession, with unemployment spiraling above 22 per cent and tens of thousands of businesses shutting down.
The austerity measures have included deep spending cuts on everything from health care to education and infrastructure, as well as tax hikes and reductions of salaries and pensions. They have provoked near-daily strikes and protests.
Virtually unknown outside of Greece four months ago, Tsipras and his party shot to prominence in the May 6 vote, where he came in a surprise second. But his pledges, which included cancelling planned privatizations, nationalizing banks and rolling back cuts to minimum wages and pensions, horrified European leaders as well as many Greeks.
Experts said his proposals would lead to Greece getting tossed out of the eurozone and immediate, severe economic hardship at home for years.
The vote went smoothly except for one incident in which 10 men armed with sledgehammers and wooden bats attacked a polling station in central Athens, wounding two policemen and setting fire to the ballot box.
Greek police were also investigating the discovery Sunday of two unexploded hand grenades outside private Skai television station on the outskirts of Athens.
Sunday's result is likely to relieve investors, but stock analysts were already warning that any bounce for financial markets could be short-lived.
"Treat knee-jerk market rallies with caution," Neil MacKinnon, global macro strategist at VTB Capital, advised clients. He warned there were still too many questions about Europe's handling of its debt crisis, plus warning signs of a slowing global economy, to celebrate the Greek vote.
Menelaos Hadjicostis and AP television in Athens contributed, as well as Paul Wiseman in Washington.
Also on HuffPost