Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

Rescuers frantically searched through the rubble of collapsed schools, homes and apartment buildings early Wednesday after Mexico's deadliest earthquake since 1985 killed at least 217 people.

The quake struck at about 2:15 p.m. ET on Tuesday and had a magnitude of 7.1, the U.S. Geological Survey said. Its epicenter was in the state of Puebla, about 80 miles southeast of Mexico City.

It came less than two weeks after a magnitude-8.1 quake hit the country and killed nearly 100.

Mexico's National Civil Defense agency put the death toll at 248 early Wednesday, but later reduced the number to 217. The reasons for this discrepancy were not immediately clear.

Dozens of buildings tumbled into mounds of rubble or were severely damaged in densely populated parts of Mexico City. Mayor Miguel Angel Mancera said buildings fell at 44 places in the capital alone as high-rises across the city swayed sickeningly.

Damaged hospitals evacuated patients.

The federal Education Department reported late Tuesday night that 25 bodies had been recovered from the wreckage of a school in southern Mexico City, where a wing of the three-story building collapsed into a massive pancake of concrete floor slabs. It was not clear whether the deaths were included in the overall toll reported by the federal civil defense agency.

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

In the Mexico City neighborhood of Roma, rescue workers cheered after finding a woman alive under rubble, according to the AP. They then quieted down to listen for calls from other survivors.

Mexico's Secretariat of National Defense said 3,400 soldiers were deployed.

Robert W. Bouman was in Mexico City visiting family when the quake struck — the second he had experienced in Mexico in less than two weeks."It's an incredibly terrifying and scary experience," Bouman, 31, told NBC News. "This time, the quake was much more violent. We had trouble standing and walking. It was impossible to maintain your balance."

Videos on social media showed tables and light fixtures shaking in restaurants and street signs and traffic lights quivering outside.

Mancera, the mayor, said 50 to 60 people were rescued alive by emergency workers and others.

President Enrique Peña Nieto was on a flight to Oaxaca when the quake struck and said in a tweet that he was immediately returning to Mexico City to assess the situation.

He later issued a video message urging calm. "The priority at this moment is to keep rescuing people who are still trapped and to give medical attention to the injured people," Peña Nieto added.

NBC News

President Donald Trump, who has clashed with Peña Nieto over his repeated calls for a border wall between their countries, sent his support in a tweet.

"God bless the people of Mexico City. We are with you and will be there for you," he wrote.

Photos: Powerful Earthquake Shakes Mexico City

Texas Gov. Greg Abbott offered "the thoughts and prayers of Texans" to Mexico and said the state would "continue to offer any support to aid Mexico in their time of need."

A spokesman for António Guterres, the secretary-general of the United Nations, said that he extended his condolences and that "the United Nations stands ready to assist."

Earthquake expert Lucy Jones, who spent 33 years at the USGS, told NBC News that the earthquake was "quite an unusual occasion" because of where it occurred.

First responders ask for silence as they search for survivors in Mexico City on Tuesday. Gustavo Martinez Contreras / AP

"It's a place that doesn't usually have earthquakes, but it can. It's sort of like having a magnitude-7 in Nevada — they aren't as common as in California, but they definitely have happened," Jones said.

Earlier on Tuesday, buildings across Mexico City held earthquake drills to mark the anniversary of the massive Sept. 19, 1985, earthquake that killed at least 9,500 people, the AP said.

Valerie Perez, 23, a student from Venezuela, ran from her fourth-floor apartment in Mexico City just in time to see the building in front of it collapse.

"A drill at 11 a.m. and an earthquake at 1 p.m.," she said. "This is the most powerful thing I have ever seen in my life."