"We recognize and respect the right of either country to build a physical barrier or wall on any of its borders," Trump said at the presidential residence in Mexico City after the two men held closed-door talks.
He acknowledged, however, that they did not discuss who will pay for the wall, despite Trump persistently stating throughout his campaign that Mexico will foot the bill for the highly controversial project.
"We didn't discuss that. We didn't discuss who pays for the wall," Trump said.
After a year of lobbing insults at Mexico, the provocative billionaire candidate was making a surprise visit to the neighboring country in the heat of the US presidential campaign, seeking to seize control of the narrative and portray himself as a capable statesman on the international stage.
It was a day of high drama for both men, who found themselves face to face after having exchanged criticisms from afar over the past year.
After Trump launched his presidential campaign last year by declaring that Mexico was sending "rapists" and other criminals across the border, Pena Nieto likened the New York businessman's isolationist positions to Nazi leader Adolf Hitler and fascist Benito Mussolini.
But he did not hide the fact that many in his country have felt the sting of Trump's harsh rhetoric.
"Mexican people felt hurt by the comments made," Pena Nieto said, with Trump at his side. "But I'm sure that the genuine interest is to build a relationship that will give both of our societies better welfare."
Trump said the two allied nations could improve ties by addressing five points: ending illegal immigration, securing the border, dismantling drug cartels, improving NAFTA -- the 22-year-old North American Free Trade Agreement that Trump argues has been a disaster for the United States -- and maintaining "manufacturing wealth" in the region.
Trump was to immediately fly to Phoenix, Arizona where he will give a highly anticipated speech on his immigration policies.
(This story has not been edited by NDTV staff and is auto-generated from a syndicated feed.)