MEXICO CITY — More than 5,000 homes were completely destroyed. The city’s 19th-century city hall, with its 30 arches, buckled. The hospital collapsed, forcing staff members to rush patients to a makeshift emergency room in a vacant lot and work by the light of their cellphones.
By the time the earthquake’s tremors finally faded, at least 45 people were dead in the state of Oaxaca, including 36 in the city of Juchitán de Zaragoza alone.
“It’s a truly critical situation,” Óscar Cruz López, the city’s municipal secretary, said Friday. “The city,” he said, and then paused. “It’s as if it had been bombed.”
Over all, the earthquake — the most powerful to hit the country in a century — killed at least 58 people in Mexico, all of them in the southern part of the country that was closer to the quake’s epicenter off the Pacific Coast.
The earthquake, which had a magnitude of 8.2 and struck shortly before midnight on Thursday, was felt by tens of millions of people in Mexico and in Guatemala, where at least one person died as well.
In Mexico City, the capital, which still bears the physical and psychological scars of a devastating earthquake in 1985 that killed as many as 10,000 people, alarms sounding over loudspeakers spurred residents to flee into the streets in their pajamas.
Windows broke and the city seemed to convulse in terrifying waves. The quake even rocked the city’s Angel of Independence monument. But this time, the megalopolis emerged largely unscathed, with minor structural damage and only two of its nearly nine million people reporting injuries, officials said.
In the southeast of the country, however, at least 10 people died in Chiapas State and three in neighboring Tabasco, including two children: one when a wall collapsed and the other after a respirator lost power in a hospital, officials said.
Chiapas officials said that more than 400 houses had been destroyed and about 1,700 others were damaged.
Juchitán, a provincial city of 100,000 in the state of Oaxaca, was devastated.
“A total disaster,” the mayor, Gloria Sánchez López, declared in telephone interview in which she appealed for help. “Don’t leave us alone.”
With the hospital — the region’s main medical center — destroyed, the patients and hundreds of wounded survivors were eventually rushed to a makeshift clinic set up in a local elementary school.
Residents spent the morning using backhoes and their bare hands to dig through the wreckage of collapsed buildings and pull the injured, and the dead, from the rubble.
By early afternoon, the efforts had mostly turned from rescues to a cleanup operation, though the municipal secretary, Mr. Cruz, said that workers were still trying to claw through the mounds of debris left by the collapse of the city hall to reach one last victim. Nobody knew if the person was still alive.
“It is a nightmare we weren’t prepared for,” said a member of the City Council, Pamela Teran, in an interview with a local radio station. She estimated that 20 to 30 percent of the houses in the city were destroyed.
“A lot of people have lost everything, and it just breaks your heart,” she added, bursting into tears.
Local officials appealed to state and federal governments for aid to help with the recovery.
“It’s impossible to resolve this catastrophe, to respond to something of this magnitude, by ourselves,” Mr. Cruz said.
Schools in at least 10 Mexican states and in Mexico City were closed on Friday as the president ordered an immediate assessment of the damage nationwide. In the hours after the quake, the National Seismological Service registered several aftershocks.
Still, the resounding feeling in the country was one, at least initially, of relief that the damage was not more widespread, given the nation’s vulnerability to earthquakes and the capital’s extreme density.
“We are assessing the damage, which will probably take hours, if not days,” said President Enrique Peña Nieto, who addressed the nation just two hours after the quake. “But the population is safe over all. There should not be a major sense of panic.”
Mexico is situated near several boundaries where portions of the earth’s crust collide. The quake on Thursday was more powerful than the one that killed nearly 10,000 people in 1985.
While the quake on Thursday struck nearly 450 miles from the capital and off the coast of Chiapas State, the one in 1985 was much closer to the city — so the shaking, coupled with Mexico City being on an ancient lake bed, proved much more deadly.
After the 1985 disaster, construction codes were reviewed and stiffened. Today, Mexico’s construction laws are considered as strict as those in the United States or Japan.
For a city used to earthquakes, Thursday’s quake left a lasting impression on residents, for both its force and duration.
“The scariest part of it all is that if you are an adult, and you’ve lived in this city your adult life, you remember 1985 very vividly,” said Alberto Briseño, a 58-year-old bar manager in Condesa. “This felt as strong and as bad, but from what I see, we’ve been spared from major tragedy.”
“Now we will do what us Mexicans do so well: t