Istanbul's mayor, Ekrem İmamoğlu, praised the victory, which deals a blow to Turkey's presidency after 20 years in power.
Turkey's main opposition party has won local elections in Istanbul and Ankara, handing President Recep Tayyip Erdogan and his Justice and Development Party (AK Party) their biggest defeat in more than two decades.
More than 95% of ballot boxes were opened in Istanbul on Sunday, with Republican People's Party (CHP) mayor Ekrem İmamoğlu announcing that he had defeated the candidate of President Recep Tayyip Erdoğan's ruling AK Party by more than 1 million votes.
Imamoglu, a former businessman, told thousands of supporters late on Sunday: “Those who cannot understand the message of the nation will ultimately lose.”
“Tonight, 16 million Istanbul citizens sent a message to both our rival and our president.”
In the capital Ankara, CHP Mayor Mansour Yabas declared victory over his rivals, hailing the result as “a clear message to those who govern this country.”
The CHP was also in the lead in Izmir, Turkey's third largest city.
According to state-run Anadolu Agency, the CHP won a total of 36 of Turkey's 81 provinces and advanced into many AK Party strongholds.
Opposition supporters gathered in Istanbul to celebrate the results, with tens of thousands lighting torches and waving Turkish flags.
In a speech from the balcony of the presidential palace, President Recep Tayyip Erdogan, who has ruled Turkey since 2002, acknowledged that his party had “lost altitude” across Turkey and said he would reflect and correct its mistakes.
“We will correct our mistakes and make up for our shortcomings,” he said.
In the last local elections in 2019, Imamoglu won the Istanbul mayoral race, dealing Erdogan and his AK Party their biggest electoral blow to date. The defeat was also a personal memory for Erdoğan, who was born and raised in the city and served as its mayor in the 1990s.
Sunday's local elections are another blow to the president, who has sought to regain control of these urban areas.
On Sunday, around 61 million people became eligible to vote in elections for mayors, provincial councilors and other local officials in Turkey's 81 provinces.
The national local elections were seen by analysts and private citizens as a gauge of both Erdogan's support and the opposition's durability amid soaring inflation and the Turkish currency's collapse against the dollar.
Sinan Urgen, director of the Istanbul-based think tank Edam, told The Associated Press that the “surprising result” was the result of voters seeking to punish the ruling party over the economic situation, adding that the election was an “immamol” “This is a watershed moment for Japan,” he said. ”
“He will emerge as a natural opposition candidate for the next presidential election,” Urgen said.