A rare and powerful 8.4-magnitude earthquake struck southern Mexico late Thursday, killing at least two people as seismologists warned of a tsunami of more than three meters (10 feet).
The quake hit offshore in the Pacific about 120 kilometers (75 miles) southwest of the town of Tres Picos in far southern Chiapas state, the US Geological Survey said, putting the magnitude at 8.1.
Mexico's seismologic service however gave a magnitude of 8.4, which if confirmed would be the most powerful ever recorded in this quake-prone country.
Two people were crushed to death in Chiapas when buildings collapsed on them, said local officials and Mexican Interior Minister Miguel Angel Osorio Chong.
The quake shook a large swath of the country and was felt as far north as Mexico City -- 1,000 km (600 miles) from the quake epicenter -- where people ran out of their homes in their pajamas as buildings trembled and swayed.
A tsunami warning and the prospect of aftershocks kept the nation on alert.
"Based on all available data ... widespread hazardous tsunami waves are forecast for some coasts," the Pacific Tsunami Warning Center said.
"Tsunami waves reaching more than three meters above the tide level are possible along the coasts of Mexico," it said, with lower waves in other countries.
The tsunami warning was for the coasts of Mexico, down through Central America into Guatemala, El Salvador, Costa Rica, Nicaragua, Panama and Honduras, and as far south as Ecuador.
The quake was felt in much of Guatemala, which borders Chiapas.
President Enrique Pena Nieto ordered schools to remain closed Friday in Chiapas and Mexico City so officials could inspect for structural damage.
He said on Twitter he was overseeing the emergency response from the National Disaster Prevention Center's headquarters.
In Mexico City, people ran out of buildings after hearing earthquake warning sirens go off just before midnight (0500 GMT Friday).
"I was driving when the ground started to shake. The car was wobbling!" said Cristian Rodriguez, a 28-year-old driver for ride-hailing service Uber in Mexico City.
"We heard an explosion. Apparently it was a transformer. The streetlights started swinging back and forth," said Mayaro Ortega, 31, a resident of the capital's north side who went running from her building.
The quake struck at a depth of 33 kilometers (21 miles), the USGS said.
It is the strongest to hit quake-prone Mexico at least since 1985, when an 8.1-magnitude earthquake in Mexico City killed more than 10,000 people.
The authorities have since instituted a stricter building code and developed an earthquake alert system using sensors placed on the coasts.
Mexico sits atop five tectonic plates, whose movement makes it one of the most earthquake-prone countries in the world.