Mr Erdogan moved swiftly on Sunday to offer investors soothing talk about respecting "the rules of a free-market economy" and plans for economic reforms. It also retained its hold over Izmir, Turkey's third largest city, located on the Aegean Sea.
Supporters of Justice and development party (AKP) wave a flag picturing Turkish president Recep Tayyip Erdogan as they celebrate during a post-election rally near the party's headquarters on March 31, 2019, in Istanbul.
The AKP built its ballot box success on Erdogan's perceived economic prowess, but days before the vote, the Turkish lira was sliding again, provoking memories of the 2018 currency crisis that badly hurt Turkish households.
For more on this story, watch 1 NEWS at 6pm.
Preliminary results showed the opposition flipping the capital Ankara and surrounding areas from Erdogan's alliance, and taking control of key Mediterranean coastal cities. The election was marred by sporadic violence, with five dead and scores injured across Turkey.
The pro-Kurdish People's Democratic Party (HDP) managed to regain several seats across the mainly Kurdish southeast of the country, where the government has replaced elected mayors with government-appointed trustees in the past after alleging that the ousted officials had links to the outlawed militant PKK, or Kurdistan Workers' Party.
"In terms of political allies he has boxed himself into a Turkish ultra-nationalist corner", said Turkey analyst Gareth Jenkins. But at the end it seems they have understood that going to the ballot box is not just about fighting for a specific opposition party.
The party of Turkish President Recep Tayipp Erdogan suffered a major defeat during Sunday's local elections.
Mansur Yavas obtained 50.9 percent of the vote, while AKP's Mehmet Ozhaseki had won 47.06 percent, with 99.8 percent of the ballots counted, the Hurriyet Daily news reported.
AKP officials had said they would object to what they claimed were tens of thousands of invalidated votes in both of the major cities. Eight years later, the Justice and Development party (AKP) he founded swept to national power.
The vote count in Istanbul, which, like Ankara, had been governed by the AKP or its Islamist predecessors for 25 years, was the most dramatic.
But it became victorious in Kars on the border with Armenia where HDP's Ayhan Bilgen got the most votes in a tight race against the Republican People's Party (CHP) and AKP's junior ally, the far-right Nationalist Movement Party (MHP).
Sunday's election was a significant victory for the opposition, which displayed good strategies and promising candidates, said Ozgur Unluhisarcikli, the Ankara director of the German Marshall Fund.
In total, three party sources told Reuters Erdogan was likely to implement cabinet changes in response to the setback, but gave no details.
Sadi Guven, the head of Turkey's high election board, told reporters that the opposition candidate, Ekrem Imamoglu, was leading his competitor, Binali Yildirim, by almost 28,000 votes.
"We will admit we won the hearts of our people in areas that we won and we will admit we were not successful enough in areas we lost".
Should this trend continue until the next general election scheduled for the centennial year 2023 and alliances progress into a more solid form of permanent cooperation it seems that a majority of Turkish voters prefer a modern form of democratic conservatism over left-leaning experiments.