A magnitude-6.5 earthquake struck in Mexico's western Guerrero state, shaking buildings and causing panic in the nation's capital and the Pacific resort of Acapulco. Officials said at least three people died, but there were no reports of widespread damage.

The U.S. Geological Survey initially estimated the quake magnitude at 6.8, but downgraded it to 6.7 and then 6.5. A quake of that magnitude is capable of causing severe damage, although the depth of this temblor lessened its impact.

The USGS said the quake occurred at 6:47 p.m. Saturday at a depth of 64.9 kilometres. It was centred about 42 kilometres southwest of Iguala in Guerrero and 166 kilometres south-southwest of Mexico City.

Mexico's Interior Department said the quake was felt in parts of nine states.

Humberto Calvo, undersecretary of Guerrero's Civil Protection agency, said three deaths had been reported in the state. He said one man was killed when a house's roof collapsed in Iguala, a second died in the small town of Ixcateopan and the driver of a cargo truck was killed by rocks that fell on the vehicle driving on the toll highway linking Acapulco with Mexico City.

Calvo said a secondary highway between the two cities was blocked in two places by rockslides.

Highrises swayed in the centre of Mexico City for more than a minute, and shoppers were temporarily herded out of some shopping centres until the danger passed.

Mexico City's mayor, Marcelo Ebrard, reported by Twitter that no major damage had been reported. He said power failed in some parts of the city.

People in one part of Mexico City's upscale Condesa neighbourhood ran out of their houses and gathered in the streets, hugging each other while some shook and began to cry.

On one street, a group of women joined hands in a circle, closed their eyes and began to pray.

"Please God, help us and let everything be OK," said one. "It's OK. It's OK. Everything is OK."

Parts of Mexico City rest on the shaky soil of a former lake bed, which tends to magnify the effect of earthquakes. An 8.1-magnitude quake in 1985 killed as many as 10,000 people in the city.

In Acapulco, which is in Guerrero, hundreds of anxious tourists congregated in the street after fleeing rocking buildings that are strung along the coastal boulevard. Patrons also left a movie theatre complex.

Authorities said they found no structural damage and had no reports of injuries in the Pacific resort, which was about 140 kilometres from the quake's epicentre.