The earthquake hit northern Afghanistan at a shallow depth of 10 kilometres (six miles) in Khulm, near the city of Mazar-i-Sharif.