PARIS — The French presidential runoff transcended national politics. It was globalization against nationalism. It was the future versus the past. Open versus closed.

But in his resounding victory on Sunday night, Emmanuel Macron, the centrist who has never held elected office, won because he was the beneficiary of a uniquely French historic and cultural legacy, where many voters wanted change but were appalled at the type of populist anger that had upturned politics in Britain and the United States. He trounced the far-right candidate Marine Le Pen, keeping her well under 40 percent, even as her aides said before the vote that anything below that figure would be considered a failure.

His victory quickly brought joy from Europe’s political establishment, especially since a Le Pen victory would have plunged the European Union into crisis. But in the end, Mr. Macron, only 39, a former investment banker and an uninspired campaigner, won because of luck, an unexpected demonstration of political skill, and the ingrained fears and contempt that a majority of French still feel toward Ms. Le Pen and her party, the National Front.