A magnitude 7 earthquake hit off the northern California coast on Thursday, prompting a tsunami warning that was later canceled for a large stretch of the California and Oregon coasts, officials said.

Some 4.7 million residents of California and Oregon had been under the tsunami warning before it was canceled, the National Weather Service said.

The quake, which hit at a shallow depth of 10 km (6.2 miles), was centered about 39 miles (63 km) west of the town of Ferndale, a sparsely populated portion of the northern California coast, the U.S. Geological Survey said.

For news impacting Canada and around the world, sign up for breaking news alerts delivered directly to you when they happen.

Get breaking National news

For news impacting Canada and around the world, sign up for breaking news alerts delivered directly to you when they happen.

By providing your email address, you have read and agree to Global News’ Terms and Conditions and Privacy Policy.

The National Tsunami Center had issued a warning for a long stretch of the U.S. West Coast, from Dunes City, Oregon, south to San Francisco and San Jose, California, 400 miles (643 km) away.

The City of Berkeley police department had issued an evacuation order for parts of the city on the San Francisco Bay “due to a Tsunami coming to West Berkeley,” according to an alert sent to residents.

About 19,000 clients were without power in Humboldt County – up from near zero before the earthquake struck, according to data from PowerOutage.us.

The office of California Governor Gavin Newsom wrote on social media that the governor “is now meeting with state emergency officials and working to ensure Californians are safe.”

–Reporting by Brad Brooks in Colorado, Rajveer Singh Pardesi, Urvi Dugar and Shivani Tanna in Bengaluru; Editing by Chris Reese and Sandra Maler