The National Seismology Service said the quake's epicenter was 31 kilometres northwest of Tecpan, in the southwestern state of Guerrero, near the Pacific resort of Acapulco.
The US Geological Survey gave a higher measurement of 7.5-magnitude for the quake, which took place at 9:27 am.
There were no immediate reports of damage, said national civil protection chief Luis Felipe Puente.
Mexico City Mayor Miguel Angel Mancera said on Twitter that authorities were checking the sprawling capital for damage.
More From This Section
Victor Espindola, an expert at the National Seismology Service, said a tsunami was unlikely to occur following the earthquake.
Mexico City, a metropolis of 20 million people, is sensitive to distant earthquakes because it was built over soft soil from a drained lake.
In 1985, thousands of people were killed in Mexico City when buildings collapsed after an 8.1-magnitude struck the Pacific coast.