Discuss as:

5.8-magnitude earthquake rattles Mexico City

A 5.8 magnitude earthquake struck Oaxaca, Mexico, on Tuesday, causing buildings to sway as far away as Mexico City, the U.S. Geological Survey reported.

Oaxaca is about 300 miles from Mexico City, where the tremors set off earthquake alarms, The Associated Press reported.

Staff at the Hotel Palacio Borghese in Oaxaca told NBC News that the quake set off the alarms, but that they did not feel it.

There were minor aftershocks in the city of Pinotepa Nacional on the Pacific Coast, but no reported injuries, Oaxaca Governor Gabino Cue tweeted on Tuesday.

The quake’s epicenter was about 20.5 miles deep, according to the USGS.

Reuters contributed to this report.