Moon Jae-in of the Liberal Democratic Party was elected South Korea's new President early on Wednesday, with his five-year term set to begin shortly after confirmation of his victory by the election watchdog.
The 64-year-old won nearly 11.7 million, or 40.3 per cent, of all votes counted as of 2:47 a.m. local time, Yonhap news agency quoted the National Election Commission (NEC) as saying.
He was followed by Hong Joon-pyo of the conservative Liberty Korea Party, who had nearly 7.3 million votes, accounting for 25.04 per cent of votes counted so far.
Less than four million out of 32.8 million votes cast in Tuesday's presidential election still remained uncounted.
The 32.8 million votes cast marked a turnout of 77.2 per cent, the highest in a presidential election since 1997.
An exit poll showed him with 41.4 per cent of all votes cast in the rare presidential by-election.
"I will build a new nation. I will make a great Korea, a proud Korea. And I will be the proud president of such a proud nation," the president-elect said late Tuesday, declaring his victory even when less than half of all votes had been counted.
Hong was quick to accept defeat as the election had been widely been considered tilted in favour of Moon and other liberal candidates.
"If the outcome of the exit poll is true, I will be happy to have rebuilt the party that had collapsed," Hong said.
Hong's former ruling party, previously called the Saenuri Party, was split in two following the defection of 33 lawmakers who backed the parliamentary impeachment of then-President Park Geun-hye over a corruption scandal.