The quake hit roughly 100 kilometres southeast of Perryville, according to the U.S. Geological Survey, at a depth of about 28 kilometres.
The tsunami warning issued by the U.S. National Weather Service covered the entire island chain stretching from the southern tip of the Alaska Peninsula. Some surrounding communities were placed under tsunami advisories, which were later lifted.
Tsunami warning sirens were heard in communities like Kodiak, according to videos on social media.
Evacuations were observed in communities like Homer, with vehicles seen heading for higher ground.
The National Weather Service and other agencies later confirmed there is no tsunami threat for other U.S. and Canadian Pacific coasts.
Just before 12:30 a.m. local time, the tsunami warning was cancelled for Alaska as well.
Multiple smaller earthquakes struck the same area off Alaska shortly after the first, the largest of them measuring at a 4.8 magnitude.
There were no immediate reports of damage in the area.
Earthquakes Canada issued a warning of a 4.6-magnitude quake near Port Hardy, B.C., in relation to the first Alaska quake, but later admitted it was a false alarm.