Unofficial data shows Erdogan's AK Party lost Istanbul, Ankara and Izmir, as the country waits for the official results.
The ruling Justice and Development (AK Party) has lost mayoral electionsin the country's three largest cities - Istanbul, Ankara and Izmir - in a stunning election setback for President Recep Tayyip Erdogan according to unofficial results published by state-run Anadolu Agency on Monday.
The official results will be released after the country's election board looks into objections by political parties, who have three days to file their complaints.
Anadolu's unofficial data shows Republican People's Party's (CHP) candidate Ekrem Imamoglu won the heated mayoral race in Istanbul, the country's largest city and economic centre, with 48.8 percent of the vote, while the AK Party candidate Binali Yildirim got 48.5 percent.
In the capital, Ankara, unofficial results showed that CHP candidate Mansur Yavas had garnered 50.9 percent, with the AK Party nominee Mehmet Ozhaseki trailing on 47.2 percent.
In the third-largest city, Izmir, the CHP candidate, Mustafa Tunc Soyer, was leading with 58 percent votes while AK Party's Nihat Zeybekci stood at 38.5 percent.
All of the votes have been counted in the three largest cities.
The ruling AK Party, which ran as part of the People's Alliance, suffered setback in Sunday's local elections, which were held against the backdrop of Turkey's first recession in a decade while its lira currency lost as much as 40 percent of its value against the US dollar last year.
The race in Istanbul was particularly tight, with both AK Party and the CHP claiming victory in Istanbul's mayoral election.
Yildirim claimed early on Monday that he had won the race by around 4,000 votes, but later admitted he was 25,000 votes behind Imamoglu from CHP, which is part of the Nation Alliance.
Yildirim, however, said that his party had objections to the results over invalid votes.
"There are 31,136 ballot boxes [in Istanbul]. If there is one invalid vote in each ballot box, it makes 31,136 votes in total, which is more than the difference [between the two sides]," he said, adding that there are some 315,500 invalid votes in the polls.
Sezgin Tanrikulu, a CHP MP from Istanbul, said that although Imamoglu won the race in Istanbul, the election board was waiting for the objection period to end for legal reasons to declare the official winner.
"There have been complaints about certain ballot boxes. Legally, the party objecting should show a valid reason in doing so over each particular ballot box. Therefore, the number of boxes votes will be recounted in is limited," he told Al Jazeera.
"The government should respect the results."
According to Galip Dalay, a visiting fellow at the University of Oxford, the results are not a mathematical loss for the AK Party, but they still would not be taken lightly by Erdogan's bloc.
"However, it is a psychological loss as it lost several major cities including the biggest three," Dalay, who is also a non-resident fellow at Brookings Institution in Doha, told Al Jazeera.
"Early elections are out of the picture due to the fact that it did not suffer major losses in terms of vote numbers, but the result might set a context for wider discussions within the party and the conservative camp in Turkey about policy choices."
Speaking at a news conference in Istanbul on Sunday, Erdogan acknowledged that his party had lost control in a number of cities and pledged that he would focus on carrying out economic reforms.
Erdogan, who was elected last year as the country's first executive president, said the next polls would be held in June 2023, adding that Turkey would carefully implement a "strong economic programme" without compromising on free-market rules.
Ozgur Dilber, a CHP volunteer, said the results showed that the AK Party's popularity was waning.
"To me, the results are proof that the number of voters who want change is increasing," he told Al Jazeera speaking on the election results on Sunday.
Turkish gov't sets up discounted food stalls ahead of local elections (2:10)
Focus on economy, security
The polls posed a major challenge for Erdogan, given a backdrop of high inflation and rising unemployment sparked by a major currency crisis last year.
Earlier this month, official statistics showed that in the last two quarters of 2018, the Turkish economy slipped into its first recession in a decade, as inflation and interest rates soared due to the currency meltdown.
In February, inflation stood at just under 20 percent, while the Central Bank's main interest rate is currently 24 percent.
In the lead-up to Sunday's vote, the People's Alliance sought to link the local polls to internal and external risks threatening the country's security.
Erdogan has often blamed foreign powers and "speculators" for the currency fluctuations and other economic woes faced by Turkey - a message he repeated this week.
For its part, the main opposition alliance has focused its campaign on the economic situation and its effect on citizens.
It also used Turkish flags in their campaigns, rather than party banners, in an apparent bid to attract voters from different backgrounds.