Civil defense officials in Mexico and the Pacific coast state of Guerrero, where the quake was centered, said there were no reports of any deaths, serious injuries or major damage.
The quake hit at 12:42 local time and lasted less than a minute, the U.S. Geological Survey said. The quake was strongly felt from the Pacific coast resort of Acapulco to the mountain capital of Mexico City, however, because it was centered inland, 40 miles northwest of Acapulco, and just 18 miles below the earth's surface.
Many of Mexico's earthquakes are centered out at sea. Gerard Fryer of the Pacific Tsunami Warning Center said the quake was too small and too far inland to produce a tsunami.
Mexico City Civil Defense Secretary Miguel Moreno Brizuela said the quake knocked out power to about 20 percent of the homes in the city's downtown district, and there were reports of blackouts in parts of Acapulco.
At the high-rise, beachside Fairmont Acapulco Princess Hotel, hundreds of guests rushed outside, huddling on deck chairs as security officials used megaphones to urge them to remain calm.
"We flew out of bed. The building was shaking," said Marcy Olsen, 41, a manager of gas stations in Grand Marais, Minn. "I said, 'I think this has to be an earthquake.' We looked out the door, and everyone was leaving."
She was on vacation with her husband, Brian Olsen, 46, and their 13-year-old twin daughters.
"Where we are from, there's no such thing," Brian Olsen said. "Blizzards and colds, yes, but no earthquakes."
In Mexico City, ambulances could be heard wailing through the streets amid reports of panic attacks. People waited outside their homes for fear of aftershocks, as police patrolled streets for damage.