The U.S. Geological Survey says the quake hit shortly after 2:30 a.m. Tuesday near Fremont, about 35 miles southeast of San Francisco. It struck at a depth of about 7 miles.
The earthquake was followed by two smaller quakes — with initial magnitudes of 2.6 and 2.7 — in the same area.
The Fremont Police Department says there have been no reports of damage or injuries.
The quakes come nearly a year after a magnitude 6.0 earthquake struck the region. The August 2014 quake was the largest to hit Northern California in a quarter-century. That quake killed one woman and caused about $400 million in property damage in Napa Valley.