A moderate 5.2 earthquake was felt overnight in the parts of Khyber Pakhtunkhwa including Malakand, Swat and Chitral on Sunday.