The quake occurred at a depth of 6.2 miles (10 km) at 12:58 local time (2028 GMT) on Sunday, 124 miles (200 km) northwest of Kabul, the US Geological Survey said.
There have been no reports of casualties or damages yet.
Tremors are a regular event in northern Afghanistan and Pakistan, especially around the Hindu Kush range where the Eurasian and Indian tectonic plates collide.