Emmanuel Macron was elected French president on Sunday with a business-friendly vision of European integration, defeating Marine Le Pen, a far-right nationalist who threatened to take France out of the European Union.

The centrist's emphatic victory, which also smashed the dominance of France’s mainstream parties, will bring huge relief to European allies who had feared another populist upheaval to follow Britain's vote to quit the EU and Donald Trump's election as U.S. president.

With the vast bulk of votes counted, Macron had around 65.5 percent to Le Pen's 34.5 - a gap wider than the 20 or so percentage points that pre-election surveys had suggested.

Even so, it was a record performance for the National Front, a party whose anti-immigrant policies once made it a pariah, and underlined the scale of the divisions that Macron must now try to heal.

After winning the first round two weeks ago, Macron had been accused of behaving as if he was already president; on Sunday night, with victory finally sealed, he was much more solemn.

"I know the divisions in our nation, which have led some to vote for the extremes. I respect them," Macron said in an address at his campaign headquarters, shown live on television.

"I know the anger, the anxiety, the doubts that very many of you have also expressed. It's my responsibility to hear them," he said. "I will work to recreate the link between Europe and its peoples, between Europe and citizens."

Later he strode alone almost grimly through the courtyard of the Louvre Palace in central Paris to the strains of the EU anthem, Beethoven's Ode to Joy, not breaking into a smile until he mounted the stage of his victory rally to the cheers of his partying supporters.

His immediate challenge will be to secure a majority in next month's parliamentary election for a political movement that is barely a year old, rebranded as La Republique En Marche ("Onward the Republic"), in order to implement his programme.

EUROPE DEFENDED

Outgoing president Francois Hollande, who brought Macron into politics, said the result "confirms that a very large majority of our fellow citizens wanted to unite around the values of the Republic and show their attachment to the European Union".

Jean-Claude Juncker, president of the European Commission, told Macron: "I am delighted that the ideas you defended of a strong and progressive Europe, which protects all its citizens, will be those that you will carry into your presidency".

Macron spoke by phone with German Chancellor Angela Merkel, with whom he hopes to revitalise the Franco-German axis at the heart of the EU, saying he planned to visit Berlin shortly.

Trump also tweeted his congratulations on Macron's "big win", saying he looked forward to working with him.

The euro currency, which had been rising for two weeks as the prospect receded that France would elect an anti-EU president, topped $1.10 in early Asian trading for the first time since the U.S. elections.

"Fading political risk in France adds to the chance that euro zone economic growth can surprise to the upside this year," said Holger Schmieding, analyst at Berenberg Bank.

The 39-year-old former investment banker, who served for two years as economy minister under Hollande but has never previously held elected office, will become France's youngest leader since Napoleon.

Le Pen, 48, said she had also offered her congratulations. But she defiantly claimed the mantle of France's main opposition in calling on "all patriots to join us" in constituting a "new political force".

Her tally was almost double the score that her father Jean-Marie, the last far-right candidate to make the presidential runoff, achieved in 2002, when he was trounced by the conservative Jacques Chirac.

Her high-spending, anti-globalisation 'France-first' policies may have unnerved financial markets but they appealed to many poorer members of society against a background of high unemployment, social tensions and security concerns.

RESHAPING THE LANDSCAPE

Despite having served briefly in Hollande's deeply unpopular Socialist government, Macron managed to portray himself as the man to revive France's fortunes by recasting a political landscape moulded by the left-right divisions of the last century.

"I've liked his youth and his vision from the start," said Katia Dieudonné, a 35-year-old immigrant from Haiti who brought her two children to Macron's victory rally.

"He stands for the change I've wanted since I arrived in France in 1985 - openness, diversity, without stigmatising anyone ... I've voted for the left in the past and been disappointed."

Macron's team successfully skirted several attempts to derail his campaign - by hacking its communications and distributing purportedly leaked documents - that were reminiscent of the hacking of Democratic Party communications during Hillary Clinton's U.S. election campaign.

Allegations by Macron's camp that a massive computer hack had compromised emails added last-minute drama on Friday night, just as official campaigning was ending.

While Macron sees France's way forward in boosting the competitiveness of an open economy, Le Pen wanted to shield French workers by closing borders, quitting the EU's common currency, the euro, radically loosening the bloc and scrapping trade deals.

When he moves into the Elysee Palace after his inauguration next weekend, Macron will become the eighth - and youngest - president of France's Fifth Republic.

Opinion surveys taken before the second round suggest that his fledgling movement, despite being barely a year old, has a fighting chance of securing the majority he needs.

He plans to blend a big reduction in public spending and a relaxation of labour laws with greater investment in training and a gradual reform of the unwieldy pension system.

A European integrationist and pro-NATO, he is orthodox in foreign and defence policy and shows no sign of wishing to change France's traditional alliances or reshape its military and peacekeeping roles in the Middle East and Africa.

NEW GENERATION

His election also represents a long-awaited generational change in French politics that have been dominated by the same faces for years.

He will be the youngest leader in the current Group of Seven (G7) major nations and has elicited comparisons with youthful leaders past and present, from Canadian Prime Minister Justin Trudeau to British ex-premier Tony Blair and even late U.S. president John F. Kennedy.

But any idea of a brave new political dawn will be tempered by an abstention rate on Sunday of around 25 percent, the highest this century, and by the blank or spoiled ballots submitted by 12 percent of those who did vote.

Many of those will have been supporters of the far-left maverick Jean-Luc Melenchon, whose high-spending, anti-EU, anti-globalisation platform had many similarities with Le Pen's.

Melenchon took 19 percent in coming fourth in the first round of the election, and pointedly refused to endorse Macron for the runoff.

France's biggest labour union, the CFDT, welcomed Macron's victory but said that the National Front's score was still worryingly high.

"Now, all the anxieties expressed at the ballot by a part of the electorate must be heard," it said in a statement. "The feeling of being disenfranchised, of injustice, and even abandonment is present among a large number of our citizens."

The more radical leftist CGT union called for a demonstration on Monday against "liberal" economic policies.

Like Macron, Le Pen will now have to work to try to convert her presidential result into parliamentary seats, in a two-round system that has in the past encouraged voters to vote tactically to keep her out.

She has worked for years to soften the xenophobic associations that clung to the National Front under her father, going so far as to expel him from the party he founded.

On Sunday night, her deputy Florian Philippot distanced the movement even further from him by saying the new, reconstituted party would not be called "National Front".