In an interview with Mexican daily Excelsior, he called Mr Trump's rhetoric "strident".
He added that "that's how [Italian fascist leader] Mussolini got in, that's how Hitler got in".
The Mexican leader also said that Mr Trump had hurt US-Mexico relations.
Donald Trump has said that if he is elected he will build a wall along the US-Mexico border to keep migrants from crossing into the US illegally.
The Republican candidate has also insisted that Mexico would pay for the border wall, which President Pena Nieto dismissed out of hand.
He said there was "no scenario" under which Mexico would ever pay for such a wall.
Mr Trump, who has made the fight against illegal immigration the main plank of his campaign, outraged Mexicans last June when he called undocumented Mexican migrants "criminals" and "rapists".
President Pena Nieto said Mr Trump offered "very easy, simple solutions to problems that are obviously not that easy to solve".
"And there have been episodes in human history, unfortunately, where these expressions of this strident rhetoric have only led to very ominous situations in the history of humanity," he said.
"That's how Mussolini got in, that's how Hitler got in, they took advantage of a situation, a problem perhaps, which humanity was going through at the time, after an economic crisis," he added.
President Pena Nieto, who had up until now avoided commenting on Mr Trump's candidacy, insisted he would be "absolutely respectful" of the US political process.
His predecessors in office, however, have been more outspoken.
Former President Vicente Fox used an expletive on live television when he said Mexico would not pay for the border wall proposed by Mr Trump.
Felipe Calderon, who governed from 2006 to 2012, also dismissed the idea saying: "Mexican people, we are not going to pay any single cent for such a stupid wall!"

The airman, whose next of kin have been informed, was shot dead while on a routine patrol of the Western Dashte area, said the Ministry of Defence.
British forces spokesman Lt Col Gordon Mackenzie said "Our thoughts and prayers are with his family and friends at this difficult time."
British military deaths in Afghanistan since 2001 now stand at 398.
The airman had been on a partnered patrol and so would have been interacting with civilians while accompanying an Afghan officer.
His death comes after Lance Corporal Gajbahadur Gurung from 1st Battalion The Yorkshire Regiment was also killed by gunfire, in Helmand's Khar Nikah area on 27 January.
Some 500 of around 9,500 British servicemen and women in Afghanistan are due to be brought home in 2012 and Prime Minister David Cameron has indicated that more will leave in 2013.
He has said he wants British forces to end combat operations in the country by 2014.

The logo, called Harmonized Chequered Emblem, replaces the first choice which was thrown out last year after the designer was accused of plagiarism.
The designer denied stealing the idea.
Organisers said the new design used traditional Japanese colours and patterns to represent the intercultural themes of the Games.
"It incorporates the message of 'unity in diversity'," they said, and the idea that the Games "seek to promote diversity as a platform to connect the world".
When designer Asao Tokolo found out he had won the re-opened contest he said "my mind has gone blank".
"I put a lot of time and effort into this design as though it was my own child."
The first design was rejected after Belgian artist Olivier Debie alleged it copied his design for a theatre logo.
The Games organising committee never agreed to the allegation of plagiarism but said there were too many doubts over the emblem for it to be used.
The logo dispute came shortly after Tokyo decided to scrap the designs for the main Olympic stadium because of spiralling construction costs.
A cheaper design, by Japanese architect Kengo Kuma, was chosen in December last year.
Mexican President Enrique Pena Nieto has compared the rhetoric of US Republican presidential candidate Donald Trump to that of German Nazi leader Adolf Hitler.
[NEXT_CONCEPT]
A Royal Air Force Regiment airman has been killed during an insurgent attack in the Nad-e Ali district of Helmand.
[NEXT_CONCEPT]
Japan's Olympic organisers have unveiled the new official logos of the 2020 Tokyo Olympic and Paralympic Games.