President Recep Tayyip Erdogan came within a fraction of a percentage point of defeating secular challenger Kemal Kilicdaroglu in the first round.
Neither one’s ability to break the 50-percent threshold sets up a historic May 28 runoff — Turkey’s first — that Erdogan enters as the strong favourite.
Kilicdaroglu’s performance was the opposition’s best of Erdogan’s two-decade rule.
But the 74-year-old former civil servant had to assume the role of consoler-in-chief instead of president-elect on Monday.
“Don’t despair,” he told his despondent supporters.
AFP looks at Sunday’s main surprises.
“It’s the economy, stupid,” strategist James Carville famously told future US President Bill Clinton when trying to come up with a battle plan for his 1992 election campaign.
Turkey’s case proved that mantra had caveats.
Erdogan entered the election battling Turkey’s worst economic crisis since the 1990s.
The official annual inflation rate touched 85 percent last year. The unofficial one calculated by economists — and trusted by most Turks — approached 200 percent.
Erdogan fought it by refusing to drop his unconventional theories and instead handed out incentives and pay rises to various segments of the population.
Analysts estimate the cost of his pledges at billions of dollars.
“The last-minute spending promises — like the 45-percent wage hike for 700,000 public servants — have helped,” said Verisk Maplecroft analyst Hamish Kinnear.
“Erdogan’s promise to rebuild areas devastated by the earthquake also appears to have cut through to voters.”
Erdogan maintained high levels of support in almost every region hit by the deadly February disaster.
Turkey’s long-repressed Kurdish community accounts for almost a fifth of the population and more than 10 percent of the vote.
It largely supported Erdogan in his first decade of rule and turned against him in the second.
Some analysts felt that the main pro-Kurdish party’s decision to formally endorse Kilicdaroglu could put him over the top.
But Erdogan used it against him by telling voters that the opposition was taking orders from the PKK Kurdish militia.
“Erdogan’s strategy of linking the opposition to the PKK and the terrorist movement paid off,” Bayram Balci of the CERI Sciences Po institute said.
Istanbul housewife Leyla Gurler said the opposition’s courtship of the pro-Kurdish HDP party concerned her.
“If the opposition had won, it would have been because of the HDP and the PKK,” said the 57-year-old. “They stood together with the PKK. They made a mistake there.”
Erdogan’s chances on May 28 are helped by the unexpected rise of little-known ultra-nationalist Sinan Ogan.
The 55-year-old picked up 5.1 percent of the vote as an independent.
He was once a member of an ultra-nationalist party that forms part of Erdogan’s parliamentary alliance and represents voters who have more in common with Turkey’s leader than the leftist Kilicdaroglu.
Analyst Umut Ozkirimli said nationalism has been a “constant” component of Turkish politics since the 1990s.
Various nationalist and far-right groups picked up 22 percent of the vote in Sunday’s legislative ballot.
“The fact that Sinan Ogan won above five percent of the vote underlines that unadulterated ultranationalism is well and alive in Turkey,” political risk consultant Anthony Skinner said.
“It would be a surprise if Ogan decides to place his support behind the moderate Kilicdaroglu for the second round of the presidential election. Erdogan is in pole position on 28 May.”
Turkey’s pollsters emerged as one of the day’s biggest losers.
Only a small fraction predicted an Erdogan victory. Some put Kilicdaroglu ahead by 10 percentage points.
“Staggering how bad the polls and most of the secular analysts were in calling this one,” emerging markets economist Timothy Ash remarked.
The veteran Turkey watcher attributed it to pollsters’ inherent political bias in a country with sharply polarised and deeply entrenched views.
“I have to say all the analysts I trust, who are closer to the (ruling party), were saying 50-50, too close to call, with a bias to Erdogan.”
Skinner noted that Kilicdaroglu’s party had spent part of Sunday night claiming to be ahead in the election and disputing the results published by state media.
Opposition “officials still have to explain why they were so bullish as the voting progressed. Were their models fundamentally flawed or was something else at play?” Skinner told AFP.