A magnitude 5.8 earthquake struck off the western coast of Africa on Tuesday, the U.S. Geological Survey reported.