One of the most powerful earthquakes ever to strike Mexico has killed at least 32 people, toppling houses and businesses and sending panicked people into the streets more than 650 miles away.

Oaxaca state governor Alejandro Murat told local media that at least 23 people in his state died, and civil defence officials said at least seven died in the state of Chiapas, which borders Guatemala, while two died in the Gulf coast state of Tabasco.

The US Geological Survey said the earthquake hit off southern Chiapas state near the Guatemalan border with a magnitude as 8.1 - equal in force to a 1985 quake that killed thousands and devastated large parts of Mexico City.

Hundreds of buildings collapsed or were damaged, power was cut to more than 1.8 million people and authorities closed schools in at least 11 states for safety checks.

The US Geological Survey recorded at least 20 aftershocks of magnitude 4.0 or greater within about five hours, and the president warned that a major aftershock as large as magnitude 7.2 could occur.

The USGS said the quake struck at 11.49pm on Thursday and its epicentre was 102 miles west of Tapachula in Chiapas. It had a depth of 43.3 miles.

The quake caused buildings to sway violently in Mexico's capital more than 650 miles away, and people still wearing nightclothes fled into the streets, gathering in frightened groups.

Chiapas governor Manuel Velasco said three people were killed in San Cristobal, including two women who died when a house and a wall collapsed. He called on people living near the coast to leave their houses as a protective measure.

"There is damage to hospitals that have lost energy," he said. "Homes, schools and hospitals have been damaged."

Tabasco governor Arturo Nunez said two children died in his Gulf coast state. One of them was killed when a wall collapsed, and the other was a baby who died in a children's hospital that lost electricity, cutting off the infant's ventilator.

The Pacific Tsunami Warning Centre said waves more than 3ft above the tide level were measured off Salina Cruz, Mexico. Smaller tsunami waves were observed on the coast or measured by ocean gauges in several other places.

The centre's forecast said Ecuador, El Salvador and Guatemala could see waves of 3ft. No threat was posed to Hawaii and the western and South Pacific.

Mexican authorities were evacuating some residents of coastal Tonala and Puerto Madero because of the warning.

The quake hit as emergency agencies were bracing for another crisis on the other side of the country. The US National Hurricane Centre said Hurricane Katia is likely to strike the Gulf coast in the state of Veracruz early on Saturday as a category two storm that could bring life-threatening floods.

In neighboring Guatemala, President Jimmy Morales spoke on national television to call for calm while emergency crews checked for damage.

"We have reports of some damage and the death of one person, even though we still don't have details," Mr Morales said. He said the unconfirmed death occurred in San Marcos state near the border with Mexico.

The quake occurred in a seismically active region near the point of collision between three tectonic plates, the Cocos, the Caribbean and the North American.

Mexico's National Seismological Service said the area has seen at least six other quakes of magnitude 7.0 or greater since 1900 - though three of those occurred within a nerve-wracking nine-month span in 1902/03.