The government said the 4.3 magnitude quake's epicenter was in a county that is part of Hebei's Langfang city.
There were no immediate reports of any damage. Buildings in Beijing shook very slightly.
China is frequently hit by earthquakes, many centered in the southwest of the country.
Northern China is much more rarely affected although in 1976, the Tangshan earthquake, just to the east of Beijing, killed up to 300,000 people.