With President Enrique Pena Nieto by his side, Francis invoked the country's struggles against corruption and crime, one day after arriving on a five-day, cross-country tour of Mexico.
The pope told the assembled lawmakers and government officials that social, cultural and political leaders have a duty to help citizens "have real access to the material and spiritual goods which are indispensable: adequate housing, dignified employment, food, true justice, effective security, a healthy and peaceful environment."
It was the kind of message that many ordinary Mexicans, fed up with a decade of drug violence that has left more than 100,000 dead of missing, were hoping for.
Mexico was reminded of its troubles on the eve of the pope's arrival, when 49 inmates were killed in a prison brawl between rival groups in the north of the country.
More From This Section
"Bravo! How great that he tells the government the truth," one woman shouted.
"The pope put the government to shame with everything that he said. Let's see if Pena Nieto does the right thing," said Ramiro Sosa, a 56-year-old shopkeeper from the crime-ridden eastern state of Veracruz.
Pena Nieto gave Pope Francis a red-carpet welcome at the ornate palace, a symbolic location as it is the seat of governments that were militantly secular throughout the 20th century.
While Mexico is the world's second most populous Catholic country after Brazil, diplomatic relations with the Vatican were only restored in 1992.
"It's the first time that a pontiff is greeted at this historic place. This reflects the good relation between the Holy See and Mexico," Pena Nieto said.