The earthquake occurred in the Pacific Ocean, off the coast of the Mexican state of Michoacán, a distance of more than 350 kilometers from the city, in the Cocos Plate subduction zone, specifically in a section of the fault line known as the Michoacán seismic gap.