The GOP nominee said he did not discuss who would pay for the wall.
Donald Trump also called Mexicans “amazing” and “spectacular” people, in contrast to earlier comments branding Mexican migrants “rapists” and “murderers”.
President Pena Nieto said Mexicans had been hurt but he respected that Donald Trump genuinely wanted to build relations.
Donald Trump will later fly to Phoenix, Arizona, to deliver a key speech on measures to tackle illegal immigration.
He has seen his poll ratings slip since the GOP conventions last month.
Both nationally and in key states, Donald Trump trails Hillary Clinton, who enjoys particularly strong support among minorities.
Donald Trump said his words to Enrique Pena Nieto had been strong and straightforward.
He tried to put behind him his previous comments on Mexicans by saying those in the US had made a “great contribution”.
“I have a great feeling for Mexicans. They are amazing people,” he said.
Donald Trump said he had employed many Mexicans and that they were “beyond reproach, spectacular people with strong values of faith and community”.
He said: “We recognize and respect the right of either country to build a physical barrier or wall on any of its borders.”
But he said there was no discussion on who would pay for the wall.
Donald Trump had earlier threatened to stop cash earned by Mexicans based in the US being sent home until the country paid for it to be built.
He concluded by saying he was honored by President Pena Nieto’s invitation to visit, adding: “I call you a friend.”
Enrique Pena Nieto accepted there were border challenges but pointed out the massive contribution Mexicans have made to the US, and that “six million jobs rely on exports to Mexico”.
He said: “My priority is to protect Mexicans wherever they may be. That is my responsibility. Mexicans in the US are honest people, hard-working people who respect their families, their community and the law. They deserve everybody’s respect.”
President Pena Nieto has invited both candidates to visit Mexico, but has faced criticism at home over Donald Trump.
Former Mexican President Vicente Fox earlier told CNN: “We don’t like him. We don’t want him. We reject his visit.”
Former First Lady Margarita Zavala also tweeted: “We Mexicans have dignity, and we reject your hate speech.”
At least two demonstrations have been planned in Mexico City.
Hillary Clinton’s campaign has not yet said if she will travel to Mexico.
The US House Ethics Committee has voted to release its report on former Republican Representative…
ABC News has agreed to pay $15 million to President-elect Donald Trump to settle a…
South Korea’s parliament has voted to impeach President Yoon Suk Yeol over his failed attempt…
Israeli war planes have carried out more than 100 air strikes in Syria on December…
President-elect Donald Trump has threatened to impose 100% tariffs on the BRICS countries if they…
Syrian troops have withdrawn from the city of Aleppo following an offensive by rebels opposed…