Quick counts show Purnama, on trial for blasphemy, losing to ex-cabinet minister after religiously divisive campaign.
Unofficial results show that the Christian governor of the Indonesian capital Jakarta has been resoundingly defeated after a campaign that opened religious and racial divides in the world’s most populous Muslim nation.
So-called quick counts by 10 research companies on Wednesday showed Anies Baswedan, a former cabinet minister, winning between 55 and 60 percent of votes in the head-to-head vote, with about 80 percent of ballots counted.
Incumbent Basuki "Ahok" Tjahaja Purnama, also known as Ahok, is on trial for blasphemy. In recent months, hundreds of thousands of Indonesians have protested against him in Jakarta, deriding his Chinese ancestry and calling for him to be imprisoned or killed.
On Thursday, prosecutors will make their sentencing demand in Purnama’s trial.
Blasphemy is a criminal offence in Indonesia and punishable by up to five years in prison.
Baswedan, a highly educated Muslim politician, capitalised on the backlash against Ahok by courting the support of conservative religious leaders and figures on the radical fringe who opposed electing a non-Muslim.
The polarising campaign has given Indonesia’s conservative Muslim groups a national stage.
Purnama won the first round in February but not by a big enough margin to avoid a runoff.
Purnama, who was Jakarta’s first Christian governor in half a century and first ever ethnically Chinese governor, had been popular with middle-class Jakartans for his efforts to stamp out corruption and make the overflowing polluted city more livable.
But his brash manner and evictions of slum communities alienated many in the city of 10 million.
Baswedan had been seen as the favourite in the runoff because the votes from a third Muslim candidate who was knocked out were expected to go to him.
Baswedan was supported by the political and business elite that Jokowi unexpectedly defeated in the 2014 presidential election and who will be seeking to unseat him in 2019.
Opponents seized their moment last year when a video surfaced of Purnama telling voters they were being deceived if they believed a specific verse in the Quran prohibited Muslims from electing a non-Muslim as leader.
Conservative Muslim groups drew huge crowds to protests in Jakarta, shaking Jokowi’s centrist government.
Purnama’s runoff defeat would be a setback for his political patron, President Joko Widodo, who on Thursday hosts Vice President Mike Pence on the Indonesian leg of an Asian tour.
Ian Wilson, an expert on Indonesia from Murdoch University in western Australia, told Al Jazeera that Purnama’s defeat would be a significant result as he had previosuly been a largely popular figure.
"I think it shows the instrumental value of invoking identity as a political weapon," said Wilson.
Wilson said the poll outcome could also be a setback for religous tolerance in terms of politics but that - in a large, diverse city like Jakarta - he did not think general tolerance was going to be under much threat.
"I think in everyday life in a city like Jakarta I don’t think there’s necessarily going to be a significant change," he said.
More than seven million people were eligible to vote and thousands of police and military personnel were deployed to secure the 13,000-plus polling places.
However, there was no sign of unrest and police said the election had run smoothly.
Voting closed at 06:00 GMT on Wednesday.