People participate in a drill in Mexico City held to commemorate the 30th anniversary of the city’s massive quake. (Alfredo Estrella/AFP/Getty Images)

Two buildings have collapsed, an auditorium and a theater. The dead and wounded lie moaning, scattered in the rubble. A gas line has ruptured and flames leap into the air. Sirens wail and a young girl with a wooden stake through her chest waves up at the helicopter circling above.

The chaotic Saturday morning scene at a government arts campus in southern Mexico City looked like an action movie set, with dozens of real-life ­role-players — police, firefighters, nurses, wounded students — and plenty of plastic corpses. It was part anniversary commemoration and part disaster drill, and it showed the elaborate lengths that Mexico City goes to prep for another earthquake like the one that rocked this megalopolis 30 years ago.

The 8.0-magnitude earthquake, centered off the coast of Michoacan, struck at 7:17 a.m. on Sept. 19, 1985, and sent shock waves through a city that was partially built on the soft earth of a filled-in lake. The front pages the morning after ran banner headlines trumpeting the destruction: “Catastrofico,” “Horror y Muerte,” “Desastre Nacional.” More than 5,000 buildings were damaged or destroyed across the city and 250,000 residents were left homeless. Although there is no precise figure, at least 5,000 people were said to have died.

Thirty years later, the legacy of that quake remains alive in both the physical architecture of the rebuilt city and the spirit of public protest and civic awareness. Volunteers sprang into action to pick through the rubble and search for survivors and later banded together to push for restitution for the victims. The earthquake revealed city government corruption and crooked practices of slumlords and sweatshop owners. It is estimated that about 1,000 women who worked in shoddily built garment factories died when the buildings collapsed.

“Through this collective experience, it began to generate something very important in Mexico City: civil society,” said Sergio Raul Arroyo, a former director of Mexico’s National Institute of Anthropology and History, who is one of the curators of a museum exhibit on the 1985 earthquake. “With all the social mobilization that accompanied this earthquake, the city would never be the same.”

Paramedics take part in a rappeling rescue during an earthquake evacuation drill in Mexico City. (Tomas Bravo/Reuters)

In the aftermath, neighborhood associations and unions formed to advocate for better housing and labor conditions. A masked superhero known as Superbarrio, the defender of victims’ rights, led protests in the city.

But problems lasted for years: A decade after the earthquake, there were still tent camps for the displaced in Mexico City, said Luisa Barrios, curator of the Museum of the City of Mexico, which has an anniversary exhibit on the quake. In preparing the exhibit, she interviewed one of the city’s former cemetery officials, who estimated that 10,000 people died and said that the crematoriums were operating around the clock for two months.

“Whole buildings fell, and whole families died. There are people that nobody identified. There were thousands and thousands who died,” she said. “1985 was an awakening for the citizens’ conscience.”

After the earthquake, and the controversial presidential elections of 1988, Cuauhtémoc Cárdenas and other leading leftist politicians created the Party of the Democratic Revolution (PRD). He and his party would be the first to win the position of elected Mexico City mayor, after it changed in 1997 from a job appointed by the president, and the PRD controlled the city for the next 15 years.

Mexico City revamped its building codes, and experts say the new construction will be far more resilient if another quake of that magnitude arrives. In 1985, Mexico had one earthquake-monitoring sensor; now there are about 100 ­solar-powered sensors across the country, said Juan Manuel Espinosa, director of the Center of Instrumentation and Seismic Registry. These feel the quakes in the coastal region and trigger automatic alerts to a network of more than 8,000 alarms, giving residents a minute’s warning before the dangerous shock waves would hit the capital.

“Mexico now has very advanced tools,” Espinosa said. “But there is a natural threat that we can't totally control.

“An earthquake could return any day and it could be larger than what we’ve already experienced.”

Rescue workers' hats sit on a memorial honoring those who died in the 1985 earthquake. (Marco Ugarte/AP)

To prepare for this scenario, Mexico rehearses disaster drills regularly, including the special anniversary one at the National Arts Center on Saturday morning. During the siren-and-alarm cacophony, firemen used circular saws to cut through concrete walls to simulate rescues. Paramedics carried immobilized students on stretchers and applied bandages and tourniquets. The organizers want all residents to practice their escape plans, shutting off electricity and gas lines, and to be ready to evacuate when the earthquake warnings blare.

“Obviously we never want something to happen,” said Pedro Martinez, director general for large emergencies in the civil protection department of the city government, as he watched workers sort through fake rubble. “But we live in a seismic zone.”

Gabriela Martinez contributed to this report.