A man sits in his wheelchair backdropped by a building damaged in a massive earthquake, in Juchitan, Oaxaca state, Mexico Friday, Sept. 8, 2017. One of the most powerful earthquakes ever to strike Mexico has hit off its southern Pacific coast, killing at least 32 people, toppling houses, government offices and businesses. (AP Photo/Luis Alberto Cruz)

A man sits in his wheelchair backdropped by a building damaged in a massive earthquake, in Juchitan, Oaxaca state, Mexico Friday, Sept. 8, 2017. One of the most powerful earthquakes ever to strike Mexico has hit off its southern Pacific coast, killing at least 32 people, toppling houses, government offices and businesses. (AP Photo/Luis Alberto Cruz)

MEXICO CITY (AP) — One of the most powerful earthquakes ever recorded in Mexico struck off the country’s southern coast, toppling hundreds of buildings and sending panicked people fleeing into the streets in the middle of the night. At least 61 people were reported dead.

The quake that hit minutes before midnight Thursday was strong enough to cause buildings to sway violently in the capital city more than 650 miles (1,000 kilometers) away. As beds banged against walls, people still wearing pajamas ran out of their homes and gathered in frightened groups.

ADVERTISEMENT

Rodrigo Soberanes, who lives near San Cristobal de las Casas in Chiapas, the state nearest the epicenter, said his house “moved like chewing gum.”

The furious shaking was followed by a second national emergency for Mexican agencies as Hurricane Katia made landfall north of Tecolutla in Veracruz state late Friday amid intense rains.

The U.S. National Hurricane Center said Katia’s maximum sustained winds had dropped to 75 mph (120 kph), making it a Category 1 storm, but it was still expected to bring life-threatening floods and a dangerous storm surge off the Gulf of Mexico.

President Enrique Pena Nieto said Friday evening in a televised address that 61 people were killed by the quake — 45 in Oaxaca state, 12 in Chiapas and 4 in Tabasco — and he declared three days of national mourning.

The worst-hit city was Juchitan, on the narrow waist of Oaxaca known as the Isthmus, where 36 quake victims died.

About half of Juchitan’s city hall collapsed in a pile of rubble and streets were littered with the debris of ruined houses. A hospital also collapsed, Pena Nieto said after touring the city and meeting with residents. The patients were relocated to other facilities.

The president said authorities were working to re-establish the supply of water and food and provide medical attention to those who need it. He vowed the government would help people rebuild and called for people to come together.

“The power of this earthquake was devastating, but we are certain that the power of unity, the power of solidarity and the power of shared responsibility will be greater,” Pena Nieto said.

Mexico City escaped major damage, but the quake terrified sleeping residents, many of whom still remember the catastrophic 1985 earthquake that killed thousands and devastated large parts of the city.

ADVERTISEMENT

Families were jerked awake by the grating howl of the capital’s seismic alarm. Some shouted as they dashed out of rocking apartment buildings. Even the iconic Angel of Independence Monument swayed as the quake’s waves rolled through the city’s soft soil.

Part of a bridge on a highway being built to the site of Mexico City’s planned new international airport collapsed due to the earthquake, local media reported.

Elsewhere, the extent of destruction was still emerging. Hundreds of buildings collapsed or were damaged, power was cut at least briefly to more than 1.8 million people and authorities closed schools Friday in at least 11 states to check them for safety.

The Interior Department reported that 428 homes were destroyed and 1,700 were damaged in various cities and towns in Chiapas.

“Homes made of clay tiles and wood collapsed,” said Nataniel Hernandez, a human rights worker living in Tonala, Chiapas, who warned that inclement weather threatened to bring more down.

“Right now it is raining very hard in Tonala, and with the rains it gets much more complicated because the homes were left very weak, with cracks,” Hernandez said by phone.

The earthquake’s impact was blunted somewhat by the fact that it was centered 100 miles offshore. It hit off Chiapas’ Pacific coast, near the Guatemalan border, with a magnitude of 8.1 — equal to Mexico’s strongest quake of the past century. It was slightly stronger than the 1985 quake, the U.S. Geological Survey said.

The epicenter was in a seismic hotspot in the Pacific where one tectonic plate dives under another. These subduction zones are responsible for producing some of the biggest quakes in history, including the 2011 Fukushima disaster and the 2004 Sumatra quake that spawned a deadly tsunami.

The quake struck at 11:49 p.m. Thursday (12:49 a.m. EDT; 4:49 a.m. GMT Friday). Its epicenter was 102 miles (165 kilometers) west of Tapachula in Chiapas, with a depth of 43.3 miles (69.7 kilometers), the USGS said.

Dozens of strong aftershocks rattled the region in the following hours.

Three people were killed in San Cristobal, including two women who died when a house and a wall collapsed, Chiapas Gov. Manuel Velasco said.

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

In Tabasco, one child died when a wall collapsed, and an infant died in a children’s hospital when the facility lost electricity, cutting off the ventilator, Gov. Arturo Nunez said.

The quake triggered tsunami warnings and some tall waves, but there was no major damage from the sea. Authorities briefly evacuated a few residents of coastal Tonala and Puerto Madero because of the warning.

The Pacific Tsunami Warning Center reported waves of 3.3 feet (1 meter) above the tide level off Salina Cruz, Mexico. Smaller tsunami waves were observed on the coast or measured by ocean gauges elsewhere.

In neighboring Guatemala, President Jimmy Morales appeared on national television to call for calm while emergency crews surveyed damage. Officials later said only four people had been injured and several dozen homes damaged.

The quake occurred near the point of collision between three tectonic plates, the Cocos, the Caribbean and the North American.

The area has seen at least six other quakes of magnitude 7.0 or greater since 1900. Three of those occurred within a nerve-wracking nine-month span in 1902-1903, according to Mexico’s National Seismological Service.

Scientists were still reviewing data, but a preliminary analysis indicated the quake was triggered by the sudden breaking or bending of the Cocos plate, which dives beneath Mexico. That type of process does not happen often in subduction zones. Usually, big quakes in subduction zones occur along the boundary between the sinking slab and the overriding crust.

“It’s unusual, but it’s not unheard of,” said seismologist Susan Hough of the USGS, describing how stresses on the seafloor can produce big earthquakes.

The new quake matched the force of a magnitude 8.1 quake that hit the country June 3, 1932, roughly 300 miles (500 kilometers) west of Mexico City.

A study by the seismological service concluded that that quake killed about 400 people and caused severe damage around the port of Manzanillo. A powerful aftershock that hit 19 days later caused a tsunami that devastated 15 miles (25 kilometers) of coastline, killing 75 people.

In Veracruz, tourists abandoned coastal hotels as winds and rains picked up ahead of Hurricane Katia’s expected landfall. Workers set up emergency shelters and cleared storm drains, and residents were urged to avoid going outside or crossing flooded rivers.

“The arrival of (hashtag)Katia may be particularly dangerous for slopes affected by the earthquake. Avoid these areas,” Pena Nieto tweeted.

___

Associated Press writers Peter Orsi in Mexico City and Frank Griffiths in London contributed to this report.