The quake was centered six miles (9.6 km) west of Pinotepa Nacional in Oaxaca, the US Geological Survey (USGS) reported. The state's governor said on his Twitter account there were no immediate reports of damage.
The quake, which struck at 13:04 GMT, was 20.5 miles (33 km) deep, the USGS said.
Some buildings in Mexico City were evacuated, but the mayor said on Twitter that there were no reports of damage.
© Thomson Reuters 2013