The quake was apparently stronger than a devastating 1985 tremor that flattened swathes of Mexico City and killed thousands, but initial reports of damage in the city were limited.
The epicentre was 123 km (76 miles) southwest of the town of Pijijiapan in the southern state of Chiapas, at a revised depth of 43 miles. Three people were killed in the state, said Manuel Velasquez, the governor of Chiapas.
The quake triggered waves as high as 2.3 ft (0.7 m) in Mexico, the Pacific Tsunami Warning Centre said. It said widespread, hazardous tsunami waves were possible within three hours.
As far as 14,000 km (8700 miles) away in the Philippines, the national disaster agency put the country’s entire eastern seaboard on alert for a possible tsunami. No forced evacuation was ordered, but residents were told to monitor emergency radio broadcasts.
In Mexico, some buildings were severely damaged in the south of the country. Windows were broken at Mexico City airport and power went out in several neighbourhoods of the capital. The cornice of a hotel collapsed in the southern tourist city of Oaxaca, a witness said.
People in the capital, one of the world’s largest cities, ran out into the streets in pyjamas and alarms sounded after the quake struck just before midnight, a Reuters witness said.
Helicopters hovered overhead a few minutes later, apparently looking for damage to buildings in the city, which is built on a spongy, drained lake bed.
In one central neighbourhood, dozens of people stood outside after the quake, some wrapped in blankets against the cool night air. Children were crying.
Liliana Villa, 35, was in her apartment when the earthquake struck and she fled to the street in her pyjamas.
“It felt horrible, and I thought, ‘this is going to fall’.”
USGS reported six aftershocks, ranging in magnitude from 4.5 to 5.7.
State oil company Pemex said it was still checking for damage at its installations but has no immediate reports of problems, including at the Salina Cruz refinery, which is in the same region as the epicentre.
“I had never been anywhere where the earth moved so much. At first I laughed, but when the lights went out I didn’t know what to do,” said Luis Carlos Briceno, an architect, 31, who was visiting Mexico City. “I nearly fell over.”