PARIS — Emmanuel Macron was elected president of France on Sunday, winning almost two-thirds of the vote to beat far-right rival Marine Le Pen in a runoff.

The centrist Macron secured 66.1 percent of the vote to Le Pen's 33.9 — a stronger-than-expected victory and a stunning achievement for a novice to electoral politics who, at 39, will be modern France's youngest president. And in an election watched closely on both sides of the Atlantic, his win is also the third consecutive setback for European populist parties who preached a mix of Trump-style nationalism and protectionism to voters fed up with conventional politics.

The former investment banker and economy minister pledged to renew French public life in a short and sober address after the result was announced. But he struck a more upbeat note in a triumphal rally outside the Louvre palace later in the evening, arriving to the strains of Beethoven's Ode to Joy, the European Union's anthem, as thousands of supporters cheered and waved French flags.

“What we have done, after so many months, is unprecedented and has no equivalent. Everyone said it was impossible — but they didn't know France!” Macron declared. He silenced supporters who whistled when he addressed Le Pen's voters. "Today, they expressed their anger, frustration, sometimes their beliefs," he said. "I respect them but I will do everything over the next five years so they have no reason to vote for extremists."

Le Pen, speaking to supporters in a suburb of the capital, conceded defeat and congratulated her rival. But she said that her National Front party would transform itself to become the main opposition to a Macron presidency. "I call on all patriots to join us," she said. "France will need you more than ever in the months to come."

"The French have chosen a European future" — European Commission President Jean-Claude Juncker

The next test for Macron and Le Pen — as well as the mainstream parties who for the first time failed to get a candidate through to the second round of a presidential vote — is next month's parliamentary election. Its outcome will determine whether Macron can translate his rout into enough seats in the National Assembly and a governing mandate to run Europe's third-largest economy.

After Britain's shock vote to leave the European Union last June and Donald Trump's rise to the American presidency in November, the West's political establishments had turned their anxious attention to a series of potentially disruptive elections in Europe. A far-right candidate narrowly lost Austria's presidential vote in December, and the Dutch reelected mainstream parties in March. Elections in Britain and Germany are on the horizon in coming months, but those outcomes aren't likely to disturb the status quo.

France was the most important electoral test of 2017. Though portrayed as an outsider, Macron emerged from the establishment, served in the government of outgoing Socialist President François Hollande and put forth a French version of Bill Clinton's old triangulation, a reformed left in the guise of centrism. The main alternative on offer in France wasn't just Le Pen, on the further reaches of the right, but also the far-left leader Jean-Luc Mélenchon; between them the duo got more than 40 percent of the vote in the first round two weeks ago, with Le Pen emerging to face off against Macron.

Euro-relief

European leaders in Brussels and Berlin breathed a sigh of relief over the outcome, seeing in Macron an enthusiastic supporter of the EU and a revived French-German partnership at its heart. European Commission President Jean-Claude Juncker tweeted that he was happy "the French had chosen a European future," and Macron's team said he had a "warm" congratulatory telephone call with Germany's Chancellor Angela Merkel.

President Trump also tweeted his congratulations to Macron. "I look very much forward to working with him!" he said. Before the first round of voting, Trump had praised Le Pen but stopped short of endorsing her.

For what used to be called the foreign policy establishment in Washington, Macron represents hope for the continuation of a European order that dates back to the end of World War II and remains anchored in the transatlantic security relationship. He takes a tough line on Russia, supporting continued sanctions against the government of Vladimir Putin.

Coming out of relative obscurity late last year, Macron became a poster child for a liberalism that had been badly shaken by the political earthquakes of the last 12 months. Former President Barack Obama went public with his endorsement.

“Europe is waiting for us to defend the enlightenment,” Macron said at the Louvre. “They are waiting for a new hope, a new humanism, for a safer world ... Europe and the world are waiting for us. They are waiting for France to surprise them.”

Liberal platform

Macron's victory was larger than had been predicted in opinion polls, which had given him a lead of around 20 percentage points in the days before the election.

The size of the victory margin belies the disenchantment of many French voters with the choice on offer. Pollsters said between 25 and 26 percent of voters stayed away on Sunday, putting turnout at its lowest level for the second round of a French presidential election since 1969. Among those who did vote, some 12 percent submitted a blank or other invalid ballot, indicating they did not support either candidate.

The far-right can take some comfort in its best electoral showing in French history. Although Le Pen fell well short of the presidency, her score is roughly double what her father, party founder Jean-Marie Le Pen, got in the second round in 2002.

Macron played the optimist in this race, campaigning on a pro-EU platform committed to free trade and economic reform. Striking a different note, Le Pen promised to clamp down on immigration, possibly leave the euro single currency — along with the EU itself — and impose economic protectionism. Her campaign went heavy on French patriotic imagery and rhetoric, and portrayed Macron as a "globalist" banker who would sell out working people.

The campaign was full of surprise twists. At the year's start, the favorite was François Fillon, the candidate of the mainstream right Les Républicains party, before allegations of embezzlement involving his wife and children saw him placed under investigation. The official Socialist candidate, Benoît Hamon, failed to inspire, and saw the left back Mélenchon, leaving him in the single-digits.

In the final stretch after the first round, Macron stumbled a couple times early on but recovered strongly in Wednesday night's one face-to-face debate against Le Pen. The last surprise came late Friday when Wikileaks dropped a huge trove of Macron campaign emails, allegedly obtained by groups linked to Russia. Coming in the blackout period of the race, the candidates and the French media largely ignored the hack or its contents.

'I need you'

Macron will take over at the Élysée Palace in a week's time, replacing Hollande, who decided not to run for re-election due to his low popularity ratings.

Macron takes charge of an economy that, while stronger than in recent years, continues to struggle with higher unemployment than the EU average.

To win next month's parliamentary elections, Macron will have to break the mold once more. His own political movement, En Marche ("On the move"), was formed just last year and this will be the first time it has fielded parliamentary candidates.

Macron takes charge of an economy that, while stronger than in recent years, continues to struggle with higher unemployment than the EU average, particularly among young people. As has been the case for nearly a generation, the French are deeply split over the best way to overhaul their state-dominated and slow-growing economy. Even if Macron wins enough seats in parliament to lead the government, he will face resistance from unions, a hostile left and the far-right to his proposed economic reforms.

“Our task is immense, it means to build, starting tomorrow, a true and strong majority," Macron said in his victory speech at the Louvre. "This majority for change is what the country aspires to and what it deserves ... This is what I am expecting from you in the next six months. I will need you again and again.”

“It won’t be easy every day, I know it," he added. "The task will be tough. I will tell you the truth.”

CORRECTION: An earlier version of this article misstated Emmanuel Macron's vote share. He won almost two-thirds of the vote.