The temblor, which hit around 12:10 p.m., was centered in the Pacific Ocean, about 24 miles west of Petrolia and 44 miles southwest of Eureka, according to USGS.
There were no immediate reports of any injuries or damage.
Shaking was felt throughout the northern part of the state and as far south as the Bay Area, USGS’s website showed.
“Moderate to strong shaking was recorded by the seismic network along the coast. The earthquake was felt in San Francisco by this CGS geologist!” the California Geological Survey tweeted.
San Francisco is about 250 miles from Petrolia.
The quake’s location was off Cape Mendocino in the Mendocino Fracture Zone, which marks the southern boundary between the Juan de Fuca and Pacific plates, according to seismologist Lucy Jones.
A tsunami warning was not issued.
As Jones explained: “It is a transform fault, meaning the motion is sideways. No vertical motion so little water is displaced and thus no tsunami warning.”
The quake’s preliminary magnitude was measured at 5.8 before it was upgraded by the Geological Survey a short time later.