The epicentre was close to a surfer resort on the Pacific coast in the southern state of Oaxaca and had a depth of 24.6 km, according to the US Geological Survey. Both the south of Mexico and the capital are still reeling from earthquakes that caused widespread damage in September.
Interior Minister Alfonso Navarrete said Friday's quake caused some superficial damage to buildings in Oaxaca, but no deaths had been reported.
Images in the media appeared to show bricks and rubble fallen from buildings, and products tumbling off shelves in a supermarket.
Tremors were felt as far away as Guatemala to the south.
In Mexico City, tall buildings swayed for more than a minute as seismic alarms sounded, with older structures in the chic Condesa neighbourhood knocking into each other, and some cracks appearing in plaster and paintwork.
Two young men standing by a building that collapsed in a September 19 earthquake were still hugging minutes after the tremor. People crowded in the streets, one lady in her pajamas.
Patricia Gutierrez, a 66-year-old English teacher, was taking a nap with her 11-month-old granddaughter, Juliet, when she heard the alarm.
"She recognized the sound. When I opened my eyes, I saw her eyes in terror. Her eyes were wide, like plates. She didn't say anything," Gutierrez said of her granddaughter.
Gutierrez managed to leave her ground floor apartment before the quake began. "I left the phone and everything except for my shoes and the baby," she said.
Guadalupe Martinez, a 64-year-old retiree, said she was still shaking from shock. But the quake was a far cry from the tremors that struck Mexico in September, Martinez said.
"This time it was strong, but it did not jump up and down," she said.
Get Breaking news, live coverage, and Latest News from India and around the world on NDTV.com. Catch all the Live TV action on NDTV 24x7 and NDTV India. Like us on Facebook or follow us on Twitter and Instagram for latest news and live news updates.