The vote, considered a verdict on Mr Erdogan's rule, has been taking place during an economic downturn.
The loss in Istanbul, analysts said, would be especially sensitive for Erdogan, who grew up in city's working-class Kasimpasa neighbourhood, and liked to tell AKP rank-and-file that victory in the city was like winning Turkey.
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 ruling Justice and Development (AK Party) candidate Binali Yildirim got 48.5 percent.
There was a three-day period for election results to be challenged, Guven said, adding that results of 84 out of 31,186 ballot boxes in Istanbul had not yet been scanned into the system due to challenges.
He said Imamoglu was leading in Istanbul by almost 28,000 votes early Monday. Erdogan's own ascent to power began there in 1994.
"There is a lot of evidence going round that Imamoglu has won Istanbul but I'm not going to crack open the champagne until I see Istanbul go red [the CHP's colour] on the [Anadolu Agency] page", said Twitter user Can Okar, summing up a common claim for anti-Erdogan Turks as the Istanbul vote remains contested: it is not the official results that matter, perhaps, but the results declared by state media. The AKP still holds a majority of Ankara's 25 districts.
Meghan Markle's freaky list of royal birthing rules she must follow
"But she went in that cab that night to a party where Prince Harry was at and the next night she went on a date with him". Meghan Markle's birth plan might just involve some new age, natural childbirth techniques , according to a new report.
During this year's mayorship campaign, Yavas was accused of forgery and tax evasion by the government.
More than 57 million voters were eligible to take part in choosing the mayors of 30 major cities, 51 provincial capitals and 922 districts in Turkey.
The main opposition Republican People's Party (CHP), allied with nationalist Good Party, won the race for municipalities of the big metropolis: Istanbul, Ankara, Izmir Antalya, Adana, along with Mersin.
Senocak said party officials had come across a large number of irregularities and that these may be enough to change the outcome of elections in Turkey's most populous province.
Rights activists and Turkey's Western allies say that under Erdogan's leadership, democracy has been eroded, particularly after a failed 2016 coup that led to tens of thousands of people being arrested.
Andrew Dawson, heading the Council of Europe's election observation mission, said Monday that they were "not fully convinced that Turkey now has the free and fair electoral environment which is necessary for genuinely democratic elections in line with European values and principles".
Over the past year, Erdogan has faced ire for an economic recession which heralds double-digit inflation, rising costs of living and high unemployment.