MEXICO CITY — Minutes before midnight, warning sirens blared across this earthquake-anxious capital.
This, in itself, was not unusual. Temblors are common here, and in recent years Mexico City has held annual disaster drills, revamped building codes and installed sophisticated sensors to be ready for an emergency. Many residents still have keen memories of the calamitous 1985 earthquake that killed at least 5,000 people here and left a quarter-million homeless.
But minutes after the sirens began wailing late Thursday, hanging houseplants started swaying and books tumbled from shelves. Plaster cracked. Streetlights shimmied like reeds in the wind. Lights went black. In pajamas and barefoot, with babies swaddled in blankets, residents rushed out of their apartments to wait in the darkened streets.
This was no drill.
This was an 8.1-magnitude earthquake, the most powerful tremor in Mexico in the past 100 years, according to President Enrique Peña Nieto, felt by some 50 million people. Mexico City, with many of its newer buildings built to withstand severe tremors, was spared significant damage, but the earthquake left pockets of destruction across southern states such as Oaxaca, Chiapas and Tabasco.
By Friday morning, Mexican authorities had put the death toll at 32 people, including 23 in Oaxaca, according to the state governor. Mexican media published photos and video of collapsed buildings and rubble in the streets. The Anel Hotel in Oaxaca collapsed, but authorities said that people inside managed to escape and that there were not believed to be any casualties.
One of the worst-hit towns appeared to be Juchitan, with 17 people reported dead and severe damage at the city hall, a market, a car dealership and a hospital. Residents put out pleas on social media for help recovering people from the wreckage.
Two children died in neighboring Tabasco state, including an infant who perished when hospital electricity failed and a ventilator shut off, said Gov. Arturo Núñez.
The earthquake was centered more than 600 miles from the capital in the Pacific Ocean off the coast of Tapachula, a town in the southern state of Chiapas famous as a way station for Central American migrants headed to the United States.
Mexican authorities closed schools on Friday in Mexico City and 11 states in the central and southern part of the country so they could check for damage to infrastructure.
The U.S. Geological Survey counted at least 20 aftershocks greater than magnitude 4.0. The shaking set off waves that washed up on the coast; some coastal residents evacuated their homes and sought shelter elsewhere.
The main quake was centered 43 miles underground, more than twice as deep as the one in 1985, and experts said that dampened its impact.
After the shaking stopped, Mexico City and other large cities emerged mostly unscathed. Peña Nieto said more than 1 million people lost power but electricity was soon restored for most of them.
Since the 1985 quake, which destroyed or damaged an estimated 5,000 buildings in Mexico City, residents here remain wary of any temblors. The devastation left a profound impact on city activists and politics, ushering in demands for more-rigorous building standards. Authorities conduct anniversary drills to teach residents how to react.
Whereas there was one earthquake sensor in Mexico in 1985, now there are about 100 solar-powered sensors around the country.
When a quake is detected, these sensors send automatic alerts to a network of 8,000 alarms, intended to provide about a minute of warning before the shock waves reach Mexico City.
Since the early 1990s, there have been various alarm systems in use in Mexico, including radio announcements, and by 2014 Mexico City had installed its current loudspeaker system, said Juan Manuel Espinosa, director of the Center of Instrumentation and Seismic Registry, a nonprofit civil society group.
While preparations have improved, Espinosa said that becoming complacent is dangerous and that the government should continue to expand the alert network.
“I don’t want to give the impression that we are prepared and doing enough for a disaster. There are building standards that must be observed. There are many factors,” he said. “If this earthquake had been half the distance between Chiapas and Mexico City, the scenario that we would be living through now would be totally different.”
“One is never fully prepared for this,” he added. “And it’s been a long time since we’ve seen something of that magnitude in this city.”
Gabriela Martinez contributed to this report.