Moon Jae-in of the left-of-center Minjoo Party has been elected president on Tuesday with 41.1 percent or over 13.4 million votes.
Moon immediately assumes the role of president on Wednesday morning because his predecessor Park Geun-hye was ousted over a corruption scandal and there is no 60-day transition period between administrations.
The runner-up was Hong Joon-pyo of the rump-ruling Liberty Korea Party, who captured 24.03 percent in a late surge, trailed by Ahn Cheol-soo of the People's Party with 21.41 percent after he failed to win over conservatives. Moon was comfortably ahead in early results as soon as voting ended at 8 p.m. Tuesday and the clear winner as early as 10:15 p.m.
The veteran politician came first in most parts of the country except excluding Daegu and the conservative strongholds of the Gyeongsang provinces. It is the first time since 2007 that a liberal candidate has won the presidential election.
Speaking to a huge crowd of supporters in Gwanghwamun Plaza at 11:50 p.m. Tuesday, Moon vowed to be "a president for all citizens" who serves "even those who did not support me."
Moon also ran for president back in 2012 but narrowly lost to Park, who was able to galvanize mostly older voters in record numbers. A one-time student activist and human rights lawyer, Moon served Roh Moo-hyun as presidential secretary when his longtime friend was elected the president in 2002. About three years after Roh's death in 2009 he was elected as a lawmaker for a constituency in the southern port city of Busan.
His victory comes as no surprise since Moon had been the frontrunner in opinion polls since early April, when the campaign went into full swing. Ahn briefly overtook him in some opinion polls last month, but Moon regained his lead after a series of TV debates.
Pundits say he owes his victory largely to the anger many feel with the conservative camp after Park's disastrous performance in office.
Turnout reached 77.2 percent, up from 75.8 percent in the previous presidential election but well short of the over 80 percent some had predicted, perhaps due to the largely lackluster field of candidates.
Moon Jae-in waves in Seoul on Tuesday after exit polls showed him as the clear winner in the presidential election. /Yonhap