The result was a relief to allies in Europe and Washington wary of a far-right challenger who was hostile to the European Union and NATO.
PARIS — Emmanuel Macron won a second term as president of France, triumphing on Sunday over Marine Le Pen, his far-right challenger, after a campaign where his promise of stability prevailed over the temptation of an extremist lurch.
Projections at the close of voting, which are generally reliable, showed Mr. Macron, a centrist, gaining 58.5 percent of the vote to Ms. Le Pen’s 41.5 percent. His victory was much narrower than in 2017, when the margin was 66.1 percent to 33.9 percent for Ms. Le Pen, but wider than appeared likely two weeks ago.
Speaking to a crowd massed on the Champ de Mars in front of a twinkling Eiffel Tower, a solemn Mr. Macron said his was a victory for “a more independent France and a stronger Europe.” He added: “Our country is riddled with so many doubts, so many divisions. We will have to be strong, but nobody will be left by the side of the road.”
Ms. Le Pen conceded defeat in her third attempt to become president, but bitterly criticized the “brutal and violent methods” of Mr. Macron, without explaining what she meant. She vowed to fight on to secure a large number of representatives in legislative elections in June, declaring that “French people have this evening shown their desire for a strong counter power to Emmanuel Macron.”
At a critical moment in Europe, with fighting raging in Ukraine after the Russian invasion, France rejected a candidate hostile to NATO, to the European Union, to the United States, and to its fundamental values that hold that no French citizens should be discriminated against because they are Muslim.
Jean-Yves Le Drian, the foreign minister, said the result reflected “the mobilization of French people for the maintenance of their values and against a narrow vision of France.”
The French do not generally love their presidents, and none had succeeded in being re-elected since 2002, let alone by a 17-point margin. Mr. Macron’s unusual achievement in securing five more years in power reflects his effective stewardship over the Covid-19 crisis, his rekindling of the economy, and his political agility in occupying the entire center of the political spectrum.
Ms. Le Pen, softening her image if not her anti-immigrant nationalist program, rode a wave of alienation and disenchantment to bring the extreme right closer to power than at any time since 1944. Her National Rally party has joined the mainstream, even if at the last minute many French people clearly voted for Mr. Macron to ensure that France not succumb to the xenophobic vitriol of the darker passages of its history.
Ms. Le Pen is a longtime sympathizer with President Vladimir V. Putin of Russia, whom she visited at the Kremlin during her last campaign in 2017. She would almost certainly have pursued policies that weakened the united allied front to save Ukraine from Russia’s assault; offered Mr. Putin a breach to exploit in Europe; and undermined the European Union, whose engine has always been a joint Franco-German commitment to it.
If Brexit was a blow to unity, a French nationalist quasi-exit, as set out in Ms. Le Pen’s proposals, would have left the European Union on life support. That, in turn, would have crippled an essential guarantor of peace on the continent in a volatile moment.
Olaf Scholz, the German chancellor, declared that Mr. Macron’s win was “a vote of confidence in Europe.” Boris Johnson, the British prime minister, congratulated the French leader and called France “one of our closest and most important allies.”
Mr. Scholz and two other European leaders had taken the unusual step last week of making clear the importance of a vote against Ms. Le Pen in an opinion article in the daily newspaper Le Monde. The letter was a reflection of the anxiety in European capitals and Washington that preceded the vote.
“It is the choice between a democratic candidate, who believes that France is stronger in a powerful and autonomous European Union, and a far-right candidate, who openly sides with those who attack our freedom and our democracy,” they wrote.
Mr. Macron’s second victory felt different from his first. Five years ago, he was a 39-year-old wunderkind bursting on the French political scene with a promise to bury sterile left-right divisions and build a more just, equal, open and dynamic society. He organized a massive celebration in the main courtyard of the Louvre to mark the dawn of a new political era in France.
Sunday night, given the war in Europe, he asked for sobriety from his supporters. As Beethoven’s “Ode to Joy,” the European hymn, played (but much more softly than in 2017), he walked onto the Champ de Mars holding the hand of his wife, Brigitte. Children surrounded the couple; the choreography conveyed simplicity and humility.
Mr. Macron has often been criticized for an aloofness bordering on arrogance during his first term.
“We avoided a certain form of violence. I am relieved,” said Eric Maus, 64, a Macron supporter. “But I feel like I am handing my daughter an uncertain world where the extreme right scores so high.”
Mr. Macron succeeded in spurring growth, slashing unemployment and instilling a start-up tech culture, but was unable to address growing inequality or simmering anger among the alienated and the struggling in areas of urban blight and rural remoteness. Societal divisions sharpened as incomes stagnated, prices rose and factories moved abroad.
As a result, Mr. Macron’s political capital is more limited, even if his clear victory has saved France from a dangerous tilt toward xenophobic nationalism and given him momentum ahead of the June legislative elections.
Still, many of the 7.7 million voters who had supported the left-wing candidate Jean-Luc Mélenchon in the first round of the presidential election on April 10 voted only reluctantly for Mr. Macron to keep Ms. Le Pen from power. Assina Channa, a Muslim of Algerian descent voting in the suburb of Saint-Denis north of Paris, said, “Nothing is going to change but I had no choice.”
Ms. Le Pen had proposed a ban on the Muslim head scarf and has regularly equated Islam with violence in the country with the largest Muslim community in western Europe. “At least he doesn’t threaten us like she does,” Ms. Channa said.
Mr. Macron acknowledged that “many of our compatriots voted for me today not to support my ideas but to form a dam against the extreme right.” He thanked them and said “I am now entrusted with their sense of duty, their attachment to the Republic and their respect for the differences expressed these past weeks.”
Some 28 percent of the electorate abstained, three percentage points higher than in 2017, and it appeared that more than 13 million people had voted for Ms. Le Pen and the extreme right. “The anger and the disagreements that led my compatriots to vote for this project must also find an answer,” Mr. Macron said.
It was a speech not of soaring rhetoric but of sober realism, almost at times contrition, reflecting his recognition of a starkly divided France and perhaps also his inattention to those for whom life has been hardest.
The dreams of radical change of 2017 have been supplanted by fears of political confrontation over the summer, in part because the dislike of Mr. Macron among his opponents is strong, and in part because the legislative elections in June could result in a National Assembly less pliant to his will.
Constantly adjusting his positions, extending the circle of his allies and refining his ideas, Mr. Macron has proved himself a consummate politician, suffocating any would-be moderate challengers. He engineered the near total demise of the center-left Socialist Party and the center-right Republicans, the two political forces at the heart of postwar French politics. It was a remarkable feat.
But there was a price to pay for all this. The old structure of French politics has collapsed, and it is less clear how the violent conflicts of society can be mediated.
Those conflicts have become more acute as anger has grown in the parts of France that have felt neglected, even forgotten, by the elites in major cities. By addressing these concerns, and promising a series of tax cuts to help people cope with rising prices for gas and electricity, Ms. Le Pen built an effective campaign.
Her message, for some voters, was that she would care for and protect them while their president seemed to have other concerns. But her nationalist message also resonated among people angered by undocumented immigrants entering the country and seeking scapegoats for the country’s problems.
The president’s problems have reflected both his personality and political choices. His highly personalized top-down style of government owed more to Bonaparte than to the democratic opening he had said he would bring to the French presidential system. His attempts to force march Europe toward a vision of “strategic autonomy” backed by its own integrated military has met resistance in the countries like Poland that are most attached to America as a European power.
Emerging from the moderate left of the political system, and supported by many Socialists five years ago, Mr. Macron veered to the right both in his initial economic policy and in a much-criticized decision to confront what he called “Islamist separatism” by shutting down several mosques and Islamic associations — often on flimsy legal grounds.
He judged that he had more to gain on the right than to fear on the fragmented left of the political spectrum in a country whose psyche has been deeply marked by several Islamist terrorist attacks since 2015. In a sense, his victory proved him correct, the master of a broad web of adjustable allegiances that left his opponents floundering.
Aida Alami, Daphné Anglès, Aurelien Breeden, Adèle Cordonnier and Constant Méheut contributed reporting.