French leader Emmanuel Macron and challenger Marine Le Pen qualified on Sunday for what promises to be a very tightly fought presidential election runoff on April 24.
It pits a pro-European economic liberal against a far-right nationalist.
With partial results putting Macron in first place ahead of Le Pen after the first-round voting, other major candidates admitted defeat.
Except for another far-right candidate, Eric Zemmour, they all urged voters to block the far-right in the second round.
But after five years in power in which his abrasive style has upset many, while Le Pen succeeded in softening her image, Macron will have to fight hard to win back disgruntled voters.
"Nothing is decided, and the battle we will wage in the next 15 days will be decisive for France and Europe," Macron told supporters, urging all voters to rally behind him on April 24th to stop the far-right from ruling the European Union's second-largest economy.
Ifop pollsters predicted a very tight runoff, with 51% for Macron and 49% for Le Pen.
The gap is so tight that victory either way is within the margin of error.
Other pollsters offered a slightly bigger margin in favour of Macron, with up to 54%.
But that was in any case much narrower than in 2017, when Macron beat Le Pen with 66.1% of the votes.
Le Pen, who had eaten into Macron's once-commanding 10-point poll lead in recent weeks thanks to a campaign focused on cost-of-living issues said she was the one to protect the weak and unite a nation tired of its elite.
"What will be at stake on April 24 is a choice of society, a choice of civilisation," she told supporters, who chanted "We will win!" as she told them: "I will bring order back to France."
Macron, meanwhile, told supporters waving French and EU flags: "The only project that is credible to help purchasing power is ours."
With 96% of the votes counted for Sunday's first round, Macron garnered 27.41% of the votes and Le Pen 24.03%. A near total count of the vote was expected for later in the night.
A Le Pen victory on April 24 would be a similar jolt to the establishment as Britain's Brexit vote to leave the European Union (EU) or Donald Trump's 2017 entry into the White House.
France would lurch from being a driving force for European integration to being led by a euro-sceptic who is also suspicious of the NATO military alliance.
While Le Pen has ditched past ambitions for a "Frexit" or to haul France out of the euro zone's single currency, she envisages the EU as a mere alliance of sovereign states.
Conservative candidate Valerie Pecresse warned of "disastrous consequences" if Macron lost, while the Socialists' Anne Hidalgo urged supporters to vote for him "so that France does not fall into hatred."
"Not one vote for Le Pen!" added hard-left candidate Jean-Luc Melenchon, who, according to the estimates, placed third with around 20% of the votes.
But they all also had very harsh words for Macron and some of the very unpopular policies of his first mandate as well as an abrasive style that has put off many voters.
Zemmour acknowledged disagreements with Le Pen, but said Macron was a worse choice.
Barely a month ago, Macron seemed on course for a comfortable re-election that, riding high in polls thanks to strong economic growth, a fragmented opposition and his statesman role in trying to avert war in Ukraine on Europe's eastern flank.
But he paid a price for late entry into the campaign during which he eschewed market walkabouts in provincial France in favour of a single big rally outside Paris.
A plan to make people work longer also proved unpopular, enabling Le Pen to narrow the gap.
Le Pen, an open admirer of Russian President Vladimir Putin until his invasion of Ukraine, had for months toured towns and villages across France.
She focused on cost-of-living issues troubling millions and tapped into anger toward rulers.