South Korea's new liberal President Moon Jae-in was sworn in on Wednesday and vowed to immediately tackle the difficult tasks of addressing North Korea's advancing nuclear ambitions and soothing tensions with the United States and China.

Moon said in his first speech as president he would immediately begin efforts to defuse security tensions on the Korean peninsula and negotiate with Washington and Beijing to ease the row over a U.S. missile defence system being deployed in the South.

He also planned to announce major cabinet and presidential staff appointments almost immediately to bring a swift end to a power vacuum left by the removal of his predecessor, Park Geun-hye, in March in a corruption scandal that rocked South Korea's business and political elite.

"I will urgently try to solve the security crisis," Moon said in the domed rotunda hall of the parliament building. "If needed, I will fly straight to Washington. I will go to Beijing and Tokyo and, if the conditions are right, to Pyongyang also."

The deployment of the Terminal High Altitude Area Defense System (THAAD) in the South has angered China, Seoul's major trading partner, which sees the U.S. system's powerful radar as a threat to its security.

The issue has clouded efforts to rein in North Korea's nuclear and missile programmes, and also led to recriminations by Beijing against South Korean companies.

Moon, 64, also pledged to sever what he described as the collusive ties between business and government that have plagued many of South Korea's family-run conglomerates, known as chaebol, and vowed to be an incorruptible leader.

"I take this office empty-handed, and I will leave the office empty-handed," Moon said.

Moon met leaders of opposition parties before his simple swearing-in ceremony at parliament and promised to coordinate better with them on national security issues.

"I can do well on matters of South-North Korea relations, national security, and the Korea-U.S. alliance if the Liberty Korea Party helps me," Moon told senior officials of the conservative opposition party. "I will share information on national security with the opposition to gather wisdom."

Office workers and passersby lined the streets as Moon's motorcade passed through central Seoul en route to the presidential Blue House from parliament.

Moon stood and waved to well-wishers through the sunroof of his limousine, which was flanked by police motorbikes and a security detail.

TRUST, UNDERSTANDING

Chinese President Xi Jinping and Japanese Prime Minister Shinzo Abe both congratulated Moon on Wednesday. Xi said China was willing to handle disputes with South Korea "appropriately" on the basis of mutual trust and understanding.

Abe said in a statement he looked forward to working with Moon to improve bilateral relations, describing Seoul as one of Japan's "most important" regional neighbours".

The decision by the ousted Park's government to host the controversial THAAD system has already proved a headache for Moon as Seoul tries to walk a fine line between Washington, its closest security ally, and China.

Moon has said the decision had been made hastily and his government should have the final say on whether to deploy it.

As president, Moon must find a way to coax an increasingly belligerent North Korea to ease its nuclear and missile threats. Pyongyang has conducted its fifth nuclear test and a series of missile launches since the start of last year, ratcheting up tension on the peninsula.

Washington wants to increase pressure on Pyongyang through further isolation and sanctions, in contrast to Moon's advocacy for greater engagement with the reclusive North.

In one of his first acts as president, Moon spoke by telephone with Chairman of the Joint Chiefs of Staff Lee Sun-jin. A separate statement from Moon's Democratic Party said he was briefed on the status of the North Korean military and South Korea's military readiness.

Moon's election could add volatility to relations with Washington, given his questioning of the THAAD deployment, but was not expected to significantly change the alliance, a U.S. official said.

The White House also congratulated Moon, saying it looked forward to working with him to strengthen the longstanding U.S.-South Korea alliance.

The National Election Commission confirmed Moon's win shortly after 8 a.m. on Wednesday (2300 GMT Tuesday).

The first major positions he was expected to fill included the prime minister, the head of the National Intelligence Service, chief of staff, and chief bodyguard, a parliament official said.

Yonhap News Agency reported Moon had already decided on provincial governor Lee Nak-yon as prime minister, although a spokesman for Moon said he was unaware of the report and declined to comment further.

Other challenges Moon faces include mending a society badly bruised by the corruption scandal that doomed Park's administration.

Moon's party lacks a majority in a divided parliament. To push through major initiatives, including creating 500,000 jobs annually and reforming the country's powerful family-run conglomerates, he will need to forge partnerships with some of the parties and politicians he fought fiercely on his path to the presidency.

Moon won with 41.1 percent of the votes but that seemingly comfortable margin belied a deep ideological and generational divide in the country of 51 million people.

Data from an exit poll conducted by South Korea's top three television networks showed that, while Moon won the majority of votes cast by those under the age of 50, conservative rival Hong Joon-pyo found strong support among voters in their 60s and 70s.