The quake was centered about 35 miles from Las Choapas, a city of about 70,000 people in the state of Veracruz, at a depth of 104 miles,the U.S. Geological Survey said.
The tremor was felt in some parts of Mexico City, about 250 miles away, prompting the evacuation of schools, hotels and office buildings.
But Mayor Marcelo Ebrard said on his Twitter account there had not been any word of damage in the country's capital, which has a population of about 20 million.
Gloria Sabala, a 70-year-old resident of Las Choapas, said the earthquake appeared to have passed and that she had not seen damage from her home close to the town center.
"We felt it but thank God we're alright," she told Reuters by telephone. "I haven't seen any damage to buildings. They're all pretty small around here."
Veracruz radio Cambio Digital said there was no damage reported at Pemex operations at the port of Coatzacoalcos and the refinery of Minatitlan, or at Mexico's sole nuclear plant in Laguna Verde, in the north of the state.
(Reporting by Anahi Rama; writing by Dave Graham; editing by Bill Trott)