Police, firefighters and ordinary Mexicans are searching for survivors in the rubble of collapsed schools, homes and apartment buildings after Mexico's deadliest earthquake in decades killed 217 people.

Tuesday's magnitude-7.1 quake struck on the 32nd anniversary of a 1985 tremor that killed thousands. Just hours earlier, people around Mexico had held earthquake drills to mark the date.

One of the most desperate rescue efforts took place at a primary and secondary school in southern Mexico City, where a wing of the three-storey building collapsed.

At the Escuela Enrique Rebsamen, journalists saw rescuers pull at least two small, sheet-covered bodies from the rubble.

The federal education department said late on Tuesday night that 25 bodies had been recovered from the school's wreckage, all but four of them children.

At the scene, volunteer rescuer Dr Pedro Serrano managed to crawl into the tottering pile of rubble.

He made it into a classroom, but found all of its occupants dead.

"We saw some chairs and wooden tables. The next thing we saw was a leg, and then we started to move rubble and we found a girl and two adults - a woman and a man," he said.

"We can hear small noises, but we don't know if they're coming from above or below, from the walls above (crumbling), or someone below calling for help."

A mix of local volunteers, police and firefighters used trained dogs and their bare hands to search through the wreckage of the school.

The crowd of anxious parents outside the gates shared reports that two families had received Whatsapp messages from girls trapped inside, but that could not be confirmed.

Mexican president Enrique Pena Nieto urged people to be calm and said authorities were moving to provide help as 40 per cent of Mexico City and 60 per cent of nearby Morelos state were without power.

He said: "The priority at this moment is to keep rescuing people who are still trapped and to give medical attention to the injured people."

People across central Mexico already had rallied to help their neighbours as dozens of buildings tumbled into mounds of rubble.

Mexico City mayor Miguel Angel Mancera said buildings fell at 44 sites in the capital alone as high-rises across the city swayed and twisted and hundreds of thousands of panicked people ran into the streets.

Volunteer Carlos Mendoza, 30, said two people were pulled alive from the ruins of a collapsed apartment building in the Roma Sur neighbourhood during a three-hour period.

"When we saw this, we came to help," he said, gesturing at the destruction. "This is ugly, very ugly."

Mr Mancera said 50 to 60 people were rescued by citizens and emergency workers in the capital.

Buildings also collapsed in Morelos state, including the town hall and local church in Jojutla near the quake's epicentre. A dozen people died in Jojutla.

The town's Instituto Morelos secondary school partly collapsed, but school director Adelina Anzures said the earthquake drill held in the morning came in handy.

"I told them that it was not a game, that we should be prepared," Ms Anzures said of the drill.

When the quake came, she said, children and teachers rapidly filed out and nobody was hurt.

The US Geological Survey said the magnitude 7.1 quake hit was centred near the Puebla state town of Raboso, 76 miles south-east of Mexico City.

Much of Mexico City is built on former lakebed, and the soil can amplify the effects of earthquakes centred hundreds of miles away.

The quake appeared to be unrelated to the magnitude 8.1 quake that struck on September 7 off Mexico's southern coast and also was felt strongly in the capital.

US Geological Survey seismologist Paul Earle noted the epicentres of the two quakes were 400 miles apart, and said most aftershocks are within 60 miles.