He also blasted Clinton for lacking any plan to curb illegal immigration.
The foreign visit raised further interest in the Phoenix event that had been anticipated nationally for more than a week yet swirled with questions of cancellation, a change in topic or a shift in Trump's policy position.
Among Pena Nieto's critics this week, the country's former president Vicente Fox tweeted, "Trump not welcome in Mexico, not by me nor the 130 million Mexicans".
Talks between the Trump campaign and the Mexican government on the trip began after Trump decided last weekend to take Pena Nieto up on an offer to meet, a source familiar with the situation said. He and Peña Nieto avoided direct confrontation in front of the cameras, airing their differences on immigration, border security and trade in cordial tones.
Yet the juxtaposition of Mr. Trump's dual performances was so jarring that his true vision and intentions on immigration were hard to discern.
Mexico's President rebuked Donald Trump as a threat to his country just hours after painting a positive picture of talks the two held on Wednesday to try to defuse tensions over the U.S. presidential hopeful's anti-Mexican campaign rhetoric.
Mexican president Enrique Peña Nieto tried to explain to Donald Trump how things look from the south side of the US-Mexican border.
Mr Trump said that he would introduce new screening tests for immigrants applying to live in the United States to ensure that the country "will get the right people". At times, he has suggested he would focus on those who have committed crimes, a variation of Obama's policy, which has faced harsh criticism from conservative commentators and voters.
Aimed at ending weeks of confusion over just where he stands on immigration, Trump's fiery speech was filled with applause lines for his loyal supporters.
Instead, Trump's speech focused mostly on laying out new policies created to amp up border enforcement by increasing the number of agents working for Immigration and Customs Enforcement (ICE), cracking down on people who overstay their visas, and reviving some old (and mostly failed) policies created to deport people who have committed crimes.
That omission didn't bother Dan Stein, who leads the Federation for American Immigration Reform, a group that pushes for stricter immigration policies. He called Trump's speech the outline of "a coherent and workable strategy".
"We have to listen to the concerns that working people, our forgotten working people, have over the record pace of immigration and its impact on their jobs, wages, housing, schools, tax bills and general living conditions", he said.
- "I am personally offended by the mainstream media's attempt to distort my comments regarding Mexico and its great people", Trump said in the days after his announcement speech.
Trump has said, if elected on November 8, he would carry out a pledge to build a wall along the USA southern border with Mexico to prevent illegal crossings into the United States.
Peña Nieto twice stressed the "responsibility" he has to defend Mexican people around the world and said Trump has made "assertions that regrettably had hurt and have affected Mexicans".
"At the beginning of the conversation with Donald Trump I made it clear that Mexico will not pay for the wall", Pena Nieto said in a tweet.
With the meeting taking place behind closed doors, it was impossible to know who was telling the truth. "He essentially rolled over and allowed Mr. Trump to get away with his own goals without getting anything in return".
Yes, illegal immigration to the U.S. is a challenge, he said during a brief press conference after their meeting August 31, but so are the weapons and money that are flowing south into Mexico and empowering drug cartels.
Yet, standing on American soil, he addressed directly a question he sidestepped when asked in Mexico. "Cooperation toward achieving the shared objective to both the United States and to Mexico", he said.
Trump repeated his central campaign promise to make Mexico pay for a wall on the border.
And writer Angeles Mastretta wrote on her Twitter account that Mexicans saw "what was expected: a president who isn't capable of demanding apologies ... how sad". "From there, the conversation addressed other issues, and developed in a respectful manner", Pena Nieto wrote.
Trump was cheered in Arizona, but his appearance in Mexico sparked anger and protests.
Quite certainly a strike against the Trump campaign, this will nearly definitely put him under higher scrutiny if he visits other countries as a representative of the United States.