A magnitude-5.8 earthquake hit western Montana early on Thursday, the U.S. Geological Survey reported, and people felt the tremor hundreds of miles away.