The Mexican Seismological Institute said the quake had a preliminary magnitude of 7, which would make it one of the stronger temblors registered in the city in several years. The epicenter was put near Tecpan, in the coastal state of Guerrero about 180 miles southwest of the capital.
Authorities were looking for damage and injuries. In some areas, telephone cell service was disrupted.
Much of Mexico City was destroyed and more than 10,000 people were killed in a magnitude 8.1 earthquake in 1985, but officials say they have put more safeguards into place since then.
Mayor Miguel Angel Mancerra, who was in the middle of a Good Friday news conference when the quake struck, said “protocols” were being immediately launched in the sprawling capital, which include dispatching helicopters to survey the most vulnerable neighborhoods.