Want smart analysis of the most important news in your inbox every weekday along with other global reads, interesting ideas and opinions to know? Sign up for the Today’s WorldView newsletter.

(Onur Gunay/Imamoglu Media team/AP)

On one level, the victory of the opposition candidate in a mayoral election in Istanbul won’t change that much. Turkish President Recep Tayyip Erdogan, the longest-serving ruler in the history of the Turkish republic, maintains his dominant hold on the levers of national power. His ruling party still controls the municipal assembly and may constrain the new mayor’s scope for action. Turkey, as of now, is not expected to hold new elections either for its presidency or its national legislature until 2023.

But make no mistake. Ekrem Imamoglu’s major win in Istanbul this Sunday was a political earthquake, one with tremors that may be felt far beyond Turkey’s most populous city — and, indeed, beyond the country’s borders. In dramatic fashion, one of the world’s towering illiberal nationalist leaders was humbled, and hope for his country’s battered democracy bloomed.

The election was a rerun of a March 31 vote that Imamoglu narrowly won over Binali Yildirim, a former prime minister and chosen candidate of Erdogan’s ruling Justice and Development Party, or AKP. At the time, the result was seen as a withering blow to Erdogan, who was born in Istanbul and launched his political career as mayor of the city. The AKP’s grip over Istanbul made it into “the financial wellspring for the ruling party’s patronage networks and a showcase for Erdogan’s ambition,” reported my colleague Kareem Fahim, referring to a string of megaprojects built on Erdogan’s watch.

And so by early April, the Turkish president and his allies moved to annul the result. Citing murky irregularities, state authorities largely under Erdogan’s thumb ruled that the election had to be redone. The decision prompted analysts overseas to start writing obituaries for the country’s doomed democracy, which in their view was being slowly choked by Erdogan’s inexorably authoritarian rule.

But they changed their tune on Monday. Not only did Imamoglu win once more, but he did so with a significantly expanded margin of more than 800,000 votes. There’s little chance Erdogan or his ruling party will be able to discredit such an emphatic victory a second time.

“In this city today, you have fixed democracy. Thank you Istanbul,” Imamoglu told supporters at a rally in Istanbul, hailing the inclusive message of his campaign. “We came to embrace everyone. We will build democracy in this city; we will build justice. In this beautiful city, I promise, we will build the future.”

As Fahim noted, the leadership in Ankara seemed somewhat magnanimous in defeat. “For many, the AKP’s swift acceptance of the election results Sunday eased fears that Turkey’s democracy was in jeopardy. Yildirim, smiling, conceded the race less than three hours after the polls had closed. Soon afterward, Erdogan sent Imamoglu a congratulatory message on Twitter, he wrote. But Fahim also pointed to ominous signs: The trial of 16 civil society activists accused of trying to overthrow the government opened Monday in Istanbul.

A significant factor in Imamoglu’s victory is the perilous state of the Turkish economy. For years, Erdogan could point to a record of booming growth, ambitious infrastructure projects and economic reforms that lifted millions of poor Turks into the middle class. But the boom was built on a staggering amount of debt and, as the New York Times put it, that bill has come due. The past two years have seen a harrowing fall in the value of the lira, the Turkish currency, rising inflation and unemployment, and recession over the last half of 2018.

Erdogan staked much of his own personal credibility on the mayoral campaign, but even he, a master electioneer, couldn’t assuage the mounting economic anxiety of the ordinary Istanbul voter. For years, he managed to secure victory in elections through a polarizing politics of grievance, appealing to once-neglected pious Turks by whipping up resentment of secular elites, while casting his various opponents as illegitimate actors and threats to the nation.

It was a form of right-wing politics that’s become familiar all over the world in the past decade and that always seemed to guarantee Erdogan just slightly more than 50 percent of the vote. “Erdogan perhaps globally invented this brand of 21st century populism," Soner Cagaptay, a Turkey scholar at the Washington Institute for Near East Policy, told Today’s WorldView at a panel event hosted by his think tank.

“But the limit of this trend is economic growth,” he added. “When the economy does well, the base loves this kind of [majoritarian] rhetoric. It’s worked for at least a dozen elections Erdogan entered.” This time, though, it did not.

Lisel Hintz, a professor at Johns Hopkins University’s School of Advanced International Studies, said that Imamoglu “deserves credit” for not engaging in the polarization of Turkish politics. His message of inclusion not just appealed to minorities and his party’s traditional base among secularists and the Turkish left, but conservative AKP voters as well. At his victory rally, supporters made heart signs with their hands.

It seemed an antidote to the tactics of “hypermasculine, nationalist, populist strongmen” like Erdogan, Rodrigo Duterte in the Philippines, Viktor Orban in Hungary or Nicolás Maduro in Venezuela, Hintz said.

“Rather than being an example of how democracies die, Turkey showcases the fact that they don’t die all that easily,” wrote Murat Somer, a professor of political science at Koc University in Istanbul. “The ascendance of authoritarianism triggers an equally strong pro-democratic reaction. And the case of the Istanbul rerun offers insights into how such impulses may be able to succeed against polarizing and populist authoritarian politics.”

The test now is to see how durable Imamoglu’s victory may be. “Erdogan has been cited by many columnists as being ahead of the democratic regression curve,” said Kemal Kirisci of the Brookings Institution, speaking at the same panel as Cagaptay and Hintz. “Maybe what’s happening in Turkey may be the beginnings of a broader democratic restoration,” he added, noting recent mass protests in the Czech Republic and Hong Kong, and the rise of new liberal forces in Europe.

Given the weight of Erdogan’s power, though, Kirisci cautioned that may just be “wishful thinking.”

Want smart analysis of the most important news in your inbox every weekday along with other global reads, interesting ideas and opinions to know? Sign up for the Today’s WorldView newsletter.