An earthquake measuring 5.9 magnitude on the Richter scale hit parts of northern Pakistan on Thursday morning, said an official with Meteorological Department of Pakistan.