The quake, which struck the western state of Guerrero at 19:47 local time, was strongly felt in Mexico City.
At least two people have died in the state, but reports suggest the country has escaped major damage.
An 18-year-old man was killed when a roof collapsed in Iguala, a small city between the capital and the tourist resort of Acapulco.
A second man, aged 25 was killed when a rock fell on a small van on the Mexico City-Acapulco highway, according to Reuters news agency.
“I was dreadfully afraid, I thought it was never going to end,” Laura Gonzalez, who was in a bar in the capital at the time of the quake which lasted 40 seconds, told Reuters.
A severe earthquake in 1985 killed thousands of people and wrecked parts of Mexico City, and many residents live with the fear of a repeat.
Shoppers at a popular department store in Condesa rushed out to the street, some of them crying and shouting, and traffic lights were out at several intersections, causing traffic jams.
“The most damage was in Iguala because the epicenter was very close to there,” a spokesman for Guerrero emergency services told Reuters.
Power was knocked out in many districts of the capital and one building was evacuated, but Mexico City Mayor Marcelo Ebrard said water services,
the subway and the airport were working normally.
“The city center is fine, there are people skating on the ice rink,” Mexico City emergency services spokesman Manuel Mondragon said of the winter entertainment facility set up in the central Zocalo square.
“At the moment, there is no reason for concern,” he told Reuters.
A source from phone operator Telcel said services went out briefly in some sections of the city as the mobile network was overloaded with people trying to call family and friends.
iM21h-kJ8tQImage source: Wikimedia Commons President-elect Donald Trump celebrated his election victory at the Ultimate Fighting…
Millions of voters across the US chose to return Donald Trump to the White House…
Donald Trump declares victory in the US election as he addresses jubilant supporters in Florida.…
Stocks around the world are rising as Donald Trump appears to be on the cusp…
Donald Trump has won Pennsylvania, North Carolina and Georgia and taken a lead over Kamala…
Quincy Jones, the celebrated musician and producer who worked with Michael Jackson, Frank Sinatra, Ray…