VANCOUVER -- A tsunami warning issued for coastal British Columbia was cancelled Tuesday morning after people living along parts of the province's coast evacuated to higher ground when a powerful earthquake struck off Alaska.

Residents in some coastal communities were woken by warning sirens shortly after the quake with a magnitude of 7.9 struck at about 1:30 a.m. Pacific time. The quake was centred 278 kilometres southeast of Kodiak in the Gulf of Alaska at a depth of about 10 kilometres.

Public Safety Minister Mike Farnworth said several communities activated their emergency plans and evacuated those at risk as the provincial emergency co-ordination centre and five regional operations centres were also mobilized.

In low-lying areas of Victoria and Esquimalt, officials went door-to-door telling people to evacuate, while elsewhere sirens and text alerts were used to get the warning out, he said in an interview.

An alert was still in place hours after the initial warning, which means there may be higher wave action in low-lying areas along the coast, Farnworth said.

"Although the tsunami warning was eventually suspended, this event demonstrates that coast warning systems do work."

Patricia Leidl, communications director with Emergency Preparedness BC, said there was a three centimetre wave and a 15 centimetre rise in sea level hours after the quake at Tofino on the west coast of Vancouver Island.

The tsunami warning covered B.C.'s north coast, Haida Gwaii, the west coast of Vancouver Island, the central coast and northeast Vancouver Island, and along the Juan de Fuca Strait.

People were told to evacuate inland or to higher ground, or move to an upper floor of a multi-story building, depending on individual situations.

Gillian Der, a University of British Columbia geography student who is studying in Queen Charlotte on Haida Gwaii, said she didn't feel the earthquake.

"I just heard the fire trucks going around, honking their horns and on the loud speaker saying there is a tsunami warning. It was very apocalyptic. So I was just running up the street to the muster station, up the big hill."

Earth sciences Prof. Brent Ward of Simon Fraser University said the quake was a strike-slip earthquake, where the plates slip sideways past each other.

"To get a tsunami, you have to have vertical movement of the sea floor and that more often occurs in what we call a thrust fault, usually in a subduction zone, where one of the plates is moving over top of the other."

Ward said when a plate moves up very quickly, that displaces the water above it, setting off a tsunami.

"It looks as though this earthquake was triggered on what we would call a transcurrent fault in the oceanic plate that is going underneath North America," he said.

The U.S. Geological Survey said dozens of aftershocks have been recorded ranging in magnitude from 3.3 to 6.9.

The last devastating tsunami to hit B.C. was 54 years ago in Port Alberni after a 9.2 earthquake off Alaska. Two waves gathered force as they raced up the funnel-like Alberni Inlet in March 1964, hitting the city with forces that swept away houses and vehicles, but caused no deaths.

Scientists in Japan, and Vancouver Island First Nations, have gathered accounts of a huge earthquake and tsunami in January 1700 that wiped out communities and killed thousands of people. A wave the height of a four-storey building hit the east coast of Japan nine hours after the original earthquake off the B.C. coast.

People in Alaska received warnings Tuesday from the National Weather Service sent to cellphones that said: "Emergency Alert. Tsunami danger on the coast. Go to high ground or move inland."

The fire chief of a city in Alaska popular with cruise ships said there was no panic as residents reacted to the tsunami warning.

Seward fire Chief Eddie Athey praised his community for doing "the right thing," calling it "a controlled evacuation" as people left for higher ground or drove along the only road out of the city.

Athey told the Associated Press the quake was gentle, and that it "felt like the washer was off balance."

The quake lasted for up to 90 seconds, long enough that he thought, "Boy, I hope this stops soon because it's just getting worse."

The Alaska Earthquake Information Center said the quake was felt widely in several communities on the Kenai Peninsula and throughout southern Alaska, but it also had no immediate reports of damage. People reported on social media that the quake was felt hundreds of kilometres away, in Anchorage.