An earthquake of magnitude 8.1 struck off the southern coast of Mexico late on Thursday, the US Geological Survey (USGS) said, killing at least 61 people and triggering small tsunami waves but no major destruction.
The quake was apparently stronger than a devastating 1985 tremor that flattened swathes of Mexico City and killed thousands, but this time damage to the city was limited.
Some of the worst initial reports came from Juchitan in Oaxaca state, where sections of the town hall, a hotel, a bar and other buildings were reduced to rubble.
Rescue workers labored through the night in badly affected areas to check for people trapped in collapsed buildings.
Windows also shattered at Mexico City airport and power went out in several neighborhoods of the capital, affecting more than 1 million people.
The cornice of a hotel came down in the southern tourist city of Oaxaca, a witness said. The tremor was felt as far away as neighboring Guatemala.
The epicenter of the quake was in the Pacific, 54 miles southwest of the town of Pijijiapan in the poor southern state of Chiapas, 43 miles deep.
Four people were killed in the state, Governor Manuel Velasco said.
Two children were killed in neighbouring Tabasco state, Governor Arturo Nunez said.
The quake triggered waves as high as 2.3 ft in Mexico, the Pacific Tsunami Warning Center said. Mexican television showed images of the sea retreating about 50 meters, and authorities evacuated some coastal areas.
The tsunami risk on the Chiapas coast does not represent a major risk, it's not very big, it's not a major worry, President Enrique Peña Nieto said in a call to TV network Televisa.
The president said more aftershocks were likely and that people should carefully check their homes and offices for structural damage and for gas leaks. We are alert, he said.
The USGS reported multiple aftershocks, ranging in magnitude from 4.3 to 5.7.
Classes were suspended in most of central and southern Mexico on Friday to allow authorities to review damage.
There was no tsunami threat for American Samoa and Hawaii, according to the US Tsunami Warning System. The national disaster agency of the Philippines put the country's eastern seaboard on alert, but no evacuation was ordered.
People in Mexico City, one of the world's largest cities, ran out into the streets in pajamas and alarms sounded after the quake struck just before midnight, a Reuters witness said.
Helicopters buzzed 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 neighborhood, 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 pajamas.
It felt horrible, and I thought, 'this is going to fall'. State oil company Pemex said it was still checking for damage at its installations. Pena Nieto said operations at the Salina Cruz refinery in the same region as the epicenter were temporarily suspended as a precautionary measure.
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