The U.S. Geological Survey said a 5.8-magnitude earthquake struck early Thursday about 7 miles away from Lincoln, Montana.