The U.S. Geological Survey says the quake's epicenter was located about 6 miles (11 kilometers) off Mexico's Pacific Coast near the town of Pinotepa Nacional in southern Oaxaca state at 5:10 a.m. local time. A magnitude-5.3 aftershock followed about three hours later.
Mexico City Mayor Marcelo Ebrard said via Twitter that everything was operating normally in the metropolis of more than 21 million people.
Mexico has been hit by several quakes in the last three weeks, rattling the nerves of weary residents.
Three tectonic plates come together off Mexico's Pacific coast, and the country is hit with hundreds of small-magnitude earthquakes each year.