An earthquake with a magnitude of 5.8 struck off the coast of Peru on Monday, the United States Geological Survey reported.