Taiwan's President Tsai Ing-wen was out in front as votes were being counted on Saturday after an election battle dominated by the democratic island's fraught relationship with China.
Unofficial live tallies kept by major local news networks showed the 63-year-old securing around 56-57 percent of more than 10 million votes counted so far.
Her main rival Han Kuo-yu, of the China-friendly Kuomintang party (KMT), trailed with 38-39 per cent on an island where some 19 million people are registered to vote.
The outcome will reverberate far beyond Taiwan's borders with Tsai and Han laying out very different visions for its future -- in particular how close the self-ruled island should tack to its giant neighbour.
Beijing views Taiwan as part of its territory and has vowed to retake the island one day, by force if necessary.
But China is also Taiwan's largest trade partner, leaving the island in a precariously dependent relationship.
More From This Section
Tsai, seeking a second four-year term, has pitched herself as a defender of Taiwan's liberal values against the increasingly authoritarian shadow cast by Beijing under President Xi Jinping.
"We hope our citizens can come out to vote to exercise their rights and make Taiwan's democracy stronger," she told reporters after voting in the capital Taipei.
Han, 62, favours much warmer ties with China -- saying it would boost Taiwan's fortunes -- and accuses the current administration of needlessly antagonising Beijing.
He has cast the election as a choice between "peace or crisis" with China, adopting the slogan "Taiwan safe, people rich".
Thousands of supporters began gathering Saturday night for election count rallies but the atmosphere at Han's event in Kaohsiung was markedly more subdued with some in tears, AFP reporters said.
A Tsai victory would infuriate Beijing, which has made no secret of wanting to see her turfed out.
Taiwan bans the publishing of polls within 10 days of elections, but the former law professor has led comfortably throughout the campaign.
Her party currently has a parliamentary majority, which analysts expect it to retain.
"We need a president who can defend freedom and democracy," Vicky Hsiao, a 37-year-old housewife, told AFP after voting in Taipei for Tsai.
"Taiwan is an independent country that doesn't belong to anyone." But others want change.
Tracy Hsueh, a saleswoman in her 50s, said she felt Tsai's government had been "fanning hatred towards China".
"I think Han can change the situation for Taiwan and I believe his promises that he can improve the economy and make people rich." The results of Saturday's vote will be closely watched by regional powers and in Washington, especially given the parlous state of US-China relations.
Taiwan has long been a potential flashpoint between China and the United States, which remains the island's main military ally.
The ruling Democratic Progressive Party leans towards independence, and Tsai rejects Beijing's view that Taiwan is part of "one China".
In the four years since Tsai won a landslide victory, Beijing has tightened the screw, severing official communications with her administration while ramping up economic and military pressure.
It also poached seven of Taiwan's few remaining diplomatic allies, hopeful that its pressure would convince voters to punish Tsai at the ballot box.
But that campaign appears to have backfired, especially in the last year after Xi gave a particularly blunt speech stating Taiwan's absorption into the mainland was "inevitable".
Taiwanese voters have been increasingly rattled by China's hardline response to pro-democracy protests in neighbouring Hong Kong and the mass internment of Uighur Muslims in Xinjiang.
Analysts say Tsai's ability to seize on the Hong Kong protests, along with Taiwan's largely successful economic navigation of the US-China trade war, has boosted her fortunes.
Last year, her party also pushed ahead with legalising gay marriage -- a first for Asia. While the move infuriated conservatives and many older Taiwanese, it reinvigorated Tsai's youth base.
Her rival Han has struggled on the campaign trail.
A plain-speaking populist, he stormed onto the political scene in 2018 when he won the mayoralty of the usually staunch DPP city of Kaohsiung, and then saw off party bigwigs to win the KMT primary.
But his political momentum slowed once he became the opposition candidate as he fought to shake off accusations he lacked experience and was too cosy with China.