Ekrem Imamoglu's victory means Turkey's largest city won't be governed by President Recep Tayyip Erdogan's party or its predecessor for the first time in 25 years.
Unofficial returns after most votes from Sunday's repeat election were counted showed Imamoglu had a clear majority. His government-backed opponent, former Prime Minister Binali Yildirim, conceded moments after early returns showed him trailing with 44% of the vote to his opponent's 54%.
Speaking to jubilant supporters on Sunday night, Imamoglu said: "Thank you, Istanbul!"
Imamoglu had narrowly won a previous mayoral election on March 31, but Turkey's electoral board annulled the results after weeks of partial recounts.
A former Turkish prime minister backed by Turkey's ruling party has conceded defeat and congratulated his opponent in Istanbul's repeated mayoral election.
Binali Yildirim said Sunday night that opposition candidate Ekrem Imamoglu was ahead as the first returns were announced.
Yildirim said: "I congratulate him and wish him success."
With nearly all votes counted, Imamoglu had a lead of more than 715,000 votes.
Imamoglu narrowly won office as mayor of Turkey's largest city on March 31 and served for 18 days. Turkey's electoral board annulled the results after weeks of partial recounts.
Turkey's election board has ruled as the vote count begins in the repeated election for Istanbul's mayor to count as valid ballots with inconsistent stamps.
Two political parties, the ruling Justice and Development Party and the opposition Republican People's Party, requested a decision on the stamps earlier Sunday.
The parties said some ballot envelopes arrived at polling stations bearing official stamps from a previous election, lacking stamps or carrying more stamps than needed.
In previous elections, the electoral board's decision to count unstamped ballots as valid fueled fears of possible fraud. Sunday's decision was sought by the rival parties.
An opposition candidate won the Istanbul mayor's race when Turkey held local elections on March 31. The governing party challenged the vote and the election board voided the results after weeks of partial recounts.
Polls have closed in Istanbul after voters cast ballots in a re-run mayoral election after a March 31 vote was voided for procedural irregularities.
Opposition candidate Ekrem Imamoglu sought to repeat his win from 12 weeks earlier to become the city's first mayor in 25 years who is not from President Recep Tayyip Erdogan's party or its Islamist-rooted predecessor.
The other candidate in Sunday's election is former Turkish Prime Minister Binali Yildirim, who received support from Erdogan at campaign rallies.
The Turkish leader was mayor of Istanbul, the country's largest city, during the 1990s.
The election board's decision to cancel the March election after the governing party challenged it polarized Turks, who attended campaign rallies in large numbers.
Turkish President Recep Tayyip Erdogan has voted in a closely watched repeat election for the next mayor of Istanbul, a contest that could have a political impact on his national government.
Erdogan cast his ballot at a suburban school, then was greeted by hundreds of supporters. He says "I believe the thinking voter will make the best decision for Istanbul."
The vote Sunday is being re-run after opposition candidate Ekrem Imamoglu won the Istanbul mayoral race in March. The result was canceled by Turkey's main election board, citing procedural irregularities, after the ruling party protested.
The two main candidates on the Istanbul ballot, Imamoglu and government-backed Binali Yildirim, also voted.
Polls have opened in a repeat election in Turkey's largest city where President Recep Tayyip Erdogan and his political allies could lose control of Istanbul's administration for the first time in 25 years.
Opposition candidate Ekrem Imamoglu narrowly inflicted a shock defeat on a pro-government candidate in March 31 local government elections and briefly served as mayor for nearly three weeks. But the election was canceled following government complaints of procedural irregularities and a spat between the two sides over recounts.
In a hard-fought campaign, Imamoglu focused on urban poverty after the country slid into recession at the end of 2018.
Polls close at 5:00 p.m. (1400 GMT) with preliminary results expected later Sunday.