The U.S. Geological Survey said the quake had a magnitude of 5.7 and was centered 90 miles (140 kilometers) southeast of the capital. The Mexican seismological service measured it at 5.9.
Puebla state civil protection chief German Garcia said there were no reports of injuries or collapsed buildings near the epicenter: "There is absolute calm, zero damage."
Puebla city is a popular tourist destination known for its gilded churches and ornate "Talavera" pottery. One of the country's main Talavera producers, Uriarte, said the quake shook shelves but the merchandise emerged unscathed.
In Mexico City, 20-year-old office worker Mariana Rodriguez was in a 19th-floor bathroom when she felt her building sway.
"I saw in the mirror that everything was moving," she said. "The soap even fell down. We were really nervous, but they didn't let us leave the building."
One 15-story apartment building in the trendy Condesa neighborhood rocked so much that doors opened and slammed shut - something the residents said sounded like "ghosts."
Many ran outside across the metropolis of 20 million. Evacuation officials steered crowds away from power lines and other potential hazards, and anxious people waited for several minutes before returning indoors.
Others immediately got on Facebook and Twitter to tell friends and family they were OK. Some said their cell phone service was knocked out.
Friday's earthquake was stronger and closer to the capital than one that hit last month. But Bruce Tresgrave of the U.S. Geological Survey said it was 35 miles (56 kilometers) below ground - deeper than normal - and thus unlikely to cause major damage.
Mexico City Mayor Marcelo Ebrard also said no damage was reported, and the capital's water system, hospitals and subway were not affected. Officials were conducting a more detailed survey.
The capital has lived through powerful earthquakes, including one in 1985 that killed as many as 10,000 people. Parts of Mexico City rest on the shaky soil of a former lake bed, which tends to magnify the effect of earthquakes.
Associated Press writers Isaac Garrido, David Koop and Carlos Rodriguez contributed to this report.
Copyright © 2009 The Associated Press. All rights reserved.