After days of speculation -- and optimistic statements by the two leaders -- President Trump and North Korean leader Kim Jong Un met and shook hands Sunday at the Demilitarized Zone between North and South Korea.

It was their first face-to-face meeting since an ill-fated summit in Hanoi, Vietnam, in February.

Trump arrived at the DMZ shortly before 2 a.m. Eastern U.S. time, accompanied by South Korean President Moon Jae-in. They were shown awaiting Kim's arrival, along with South Korean military members and other officials.

But before the meeting with Kim was expected to begin, Trump met with some military members and others and was expected to review some relics from the Korean War era.

"We're with you all the way," Trump told the service members, who included both U.S. troops stationed in South Korea as well as South Korean forces.

Finally around 2:40 a.m. ET, the two leaders spotted one another from a short distance apart, then walked toward one another. They met, shook hands, then briefly walked across the border into North Korea before crossing back to the DMZ.

Trump became the first sitting U.S. president to step foot inside the Hermit Kingdom.

"I was proud to step over the line," Trump told Kim later, inside the Freedom House on the South Korea side, according to the Associated Press. "It is a great day for the world."

Kim appeared pleased by the meeting, the report said.

"I believe this is an expression of his willingness to eliminate all the unfortunate past and open a new future," Kim said of Trump, according to the AP. He added that he was "surprised" when Trump extended the invitation on Saturday.

"I believe this is an expression of [President Trump's] willingness to eliminate all the unfortunate past and open a new future." — Kim Jong Un, North Korean leader

TRUMP HEADS TO DMZ, DANGLING POSSIBILITY OF MEETING KIM AND CROSSING INTO NORTH KOREA

Earlier, while taking in the view from Observation Post Ouellette at the DMZ before meeting with Kim, Trump told reporters that there has been "tremendous" improvement in U.S.-North Korea relations since the first summit with Kim in Singapore last June.

Later, Trump said he would invite Kim to visit the U.S., and possibly the White House.

"I would invite him right now," Trump said, according to the AP.

Kim, speaking through a translator, said he would invite Trump to Pyongyang, the North Korean capital, "at the right time."

It was Trump's first visit to the DMZ, which every president since Ronald Reagan -- except for President George H.W. Bush -- has toured during their time in office, according to the Associated Press. But the elder Bush, who died last year, visited the DMZ while serving as vice president under Reagan, the AP reported.

Earlier Sunday, Moon told reporters that Kim had agreed to meet with Trump. The confirmation came at a joint news conference between Moon and Trump following their brief meeting in Seoul.

"President Trump is the maker of peace in the Korean Peninsula," Moon said in announcing the plan.

"President Trump is the maker of peace in the Korean Peninsula." — South Korean President Moon Jae-in

Prior to the news conference, both Trump and Kim had expressed hopes that the meeting would be possible. But Trump said earlier Sunday that logistical and security issues still needed to be addressed.

At the news conference, Moon told reporters that Kim had accepted Trump's invitation to meet at the DMZ, the heavily fortified site at the Korean border village of Panmunjom. Trump also offered to be the first U.S. president to step into North Korea.

Trump told reporters he was looking forward to the meeting with Kim, which would follow their previous summits -- at Singapore last June and in Hanoi in February.

Nonetheless, Trump downplayed the significance of the meeting, saying it would be "just a step" in trying to repair the relationship between the U.S. and North Korea and move toward a U.S. goal of nuclear disarmament on the Korean Peninsula.

CLICK HERE TO GET THE FOX NEWS APP

Trump is in South Korea visiting Moon after attending the G-20 Summit in Osaka, Japan, where he met with the leaders of China, Russia and Saudi Arabia, among others.

This is a developing story. Check back for updates. The Associated Press contributed to this report.