Former education minister Anies Baswedan won the election with 58 percent in an unofficial quick count.
A former Indonesian education minister won the race for Jakarta governor on Wednesday after a polarising campaign that cast a shadow over Indonesia's reputation for religious tolerance.
Anies Baswedan won with 58 percent of the votes versus 42 percent for Basuki Tjahaja Purnama, known by his Chinese nickname as "Ahok," based on 100 percent of the votes in an unofficial "quick count" by Indikator Politik.
"We celebrate diversity ... We are all ready to work together again," Baswedan said.
Purnama, the city's first non-Muslim governor for half a century and its first ethnic Chinese leader, congratulated Baswedan and his running mate, adding: "We are all the same, we want a good Jakarta, because it is our home."
The election came on the eve of a visit by US Vice President Mike Pence, as the Trump administration seeks to engage the world's fourth-largest nation and largest Muslim-majority country as an emerging regional power.
The national elections commission will announce official results in early May.
Jack Hewson has more.
A divisive election
Religious tensions have been an undercurrent in the campaign, with Purnama on trial for blasphemy over comments he made last year that many took to be insulting to Islam.
Hundreds of thousands of Muslims took to the streets late last year to call for his sacking and to urge voters not to elect a non-Muslim leader. One person died and more than 100 were injured after one protest turned violent.
The Jakarta election will be seen as a barometer for the 2019 presidential election, given the city's outsized importance as both the nation's capital and commercial centre.
Purnama is backed by President Joko Widodo's ruling party. Baswedan is supported by a retired general, Prabowo Subianto, who narrowly lost to Widodo in a 2014 presidential vote and is expected to challenge him again.