There have been no reports of injures or major damage.
The tremor measured 5.8 on the Richter scale and was centred off the coast of southern Oaxaca state, about 530km southeast of Mexico City, according to the National Autonomous University of Mexico's earthquake centre.
Authorities in the capital said they had received no reports of injures or major damage, but phone service near the epicentre was knocked out, making it difficult to know immediately the extent of the damage in that area.
Brian Lassige, of the US Geological Survey in Golden, Colorado, said officials there registered the quake at 5.6-magnitude.
He said the temblor probably felt worse than it actually was in Mexico City.
"The city, it's like a bowl of Jell-O," he said.
"It's built on a lake that has been filled in and it amplifies any movement."
Hundreds of people in the capital spilled out of homes, stores and office buildings and congregated on streets beginning to fill up with rush hour traffic just before 6pm (9am AEST).
