Moments later, they returned to the South Korean side and joined South Korea's President Moon Jae-in for a brief chat, marking an unprecedented three-way gathering.
Trump and Kim then held a closed-door meeting for nearly an hour.
"The meeting was a very good one, very strong ... We agreed to work out details," Trump said.
"We'll see what can happen," He said both sides would set up teams to push forward stalled talks aimed at getting North Korea to give up its nuclear weapons, adding he was in no rush for a deal.
Trump and Kim met for the first time in Singapore in June last year, and agreed to improve relations and work towards the denuclearisation of the Korean peninsula.
But there has been little progress since then.
A second summit in Hanoi, Vietnam, in February broke down after the two sides failed to narrow differences between a US
demand for North Korea to give up its nuclear weapons and a North Korean demand for sanctions relief.
Kim looked relaxed and smiled as he chatted with Trump amidst a throng of press photographers, aides and bodyguards.
"I was surprised to see your message that you wanted to meet me," he told Trump, referring to Trump's Saturday offer, in a Twitter posting, to meet.
"This is an expression of his willingness" to work towards a new future, Kim said.
Kim said it would be a great honour if Trump visited his capital of Pyongyang.
"To cross that line was a great honour," Trump said, referring to his brief incursion into the North Korean side of the DMZ.
"It's a great day for the world," he said.
"We moved mountains" to arrange the meeting at such short notice, he said.
Trump arrived in South Korea late on Saturday for talks with Moon after attending a Group of 20 summit in Osaka, Japan, during which he made the surprise, spur-of-the-moment offer to meet Kim, who accepted it.
Trump and Kim met in the so-called Joint Security Area (JSA), which is patrolled by soldiers from both Koreas. Moon joined the two after their initial handshakes.
Trump said he had "plenty of time" and was in "no rush" to reach a deal.
"We want to get it right," he said.
North Korea has pursued nuclear and missile programmes for years in defiance of U.N. Security Council resolutions, and easing tensions with North Korea is one of the US president's top foreign policy priorities.
The DMZ was set up after the 1950-53 Korean War ended in an armistice, not a truce, leaving North Korea and a US-led U.N.
forces still technically at war.