Crowds of people gathered on Mexico City's central Reforma Avenue as well as on streets in Oaxaca state's capital, nearer the quake's epicentre, which was in a rural area close to Mexico's Pacific coast and the border with Guerrero state. "It started to shake; the cars were going here and there. What do I do?"
In Oaxaca, one of the states affected the most by the earthquakes of September 2017, the natural disaster caused panic among residents in areas such as Juchitan and Playa Vicente, on the coasts of the state.
The quake was initially given a magnitude of 7.5 but was later revised down to 7.2.
The origin of the quake was reported to be 43 kilometers, or 26.7 miles, deep.
Both the south of Mexico and the capital are still reeling from earthquakes that caused widespread damage in September and the powerful, sustained shaking on Friday caused widespread panic.
The Oaxacan town of Jamiltepec appeared to sustain the heaviest impact in the southern region, with 50 homes damaged along with a church and government building, the state's civil protection agency said.
That included reports of a wall that collapsed in the upscale Condesa neighborhood, which was hit hard by last year's quakes. Footage inside a building show lights swaying back and forth with people lined up along a hallway.
Images from the scene showed collapsed buildings and rubble.
The quake did not directly cause fatalities, but damaged dozens of buildings and knocked out power for a million people, authorities said. Later Friday, a magnitude 5.8 aftershock hit Oaxaca, the USGS tweeted.
IDF soldiers search for survivors in a building that collapsed during an quake that struck Mexico on September 24, 2017.
The epicenter of the quake was some 240 miles (386 km) west of the refinery.