The pontiff used the service in Ecatepec, a rough Mexico City suburb, to touch on two major themes of his trip to Mexico -- drug violence and the plight of migrants.
The pope urged his flock to turn the country into a "land of opportunity," where "there will be no need to emigrate in order to dream" and where they will "not have to mourn men and women, young people and children who are destroyed at the hands of the merchants of death."
The city lies in the populous state of Mexico, where some 600 women have been killed between January 2014 and September 2015, according to the non-governmental National Citizen Observatory of Femicides.
Francis urged the faithful to resist the three temptations of Christ -- vanity, pride and wealth -- during the homily.
Also Read
"Brothers and sisters, let's get this into our heads: You can't talk with the devil. You can't talk with him because he will always defeat us," the 79-year-old emphasized, going off-script from his prepared remarks.
The pontiff received a jubilant welcome after arriving from Mexico City in a helicopter, which had flown him over the majestic Moon and Sun pyramids of the pre-Columbian city of Teotihuacan.
Throngs lined the concrete-laden streets of Ecatepec, whose walls were decorated with graffiti art featuring the pope's image, to cheer the popemobile on the second full day of a trip that will take him to other Mexican hotspots.
Thousands had spent the night outdoors, wrapping themselves in blankets and using cardboard as makeshift tents against the freezing cold.
"We know that Ecatepec has a lot of problems like the lack of security and kidnappings," said Rodrigo Perez, a 25-year-old public security student.
But the pope's visit, he said, is a chance to "talk about peace and unity."
The Argentine-born pontiff made it clear before his arrival in Mexico that he would speak out about the corruption and crime afflicting parts of the country.