More than 100 homes collapsed in North West Frontier Province after the quake measuring 5.7 on the Richter scale hit at 3:30pm followed by an aftershock measuring 5.5.
"Some 20 people have died, including ten in a passenger van when it was caught in a landslide in the northern town of Batgram," said Brigadier Javed Cheema, head of the ministry's National Crisis Management Cell.
The van crashed into a ravine after being struck by a falling boulder in Batgram, 120 kilometres north of Islamabad, he said.
The rest of the victims were killed by collapsing buildings.
Cracks have appeared in hundreds of buildings and roads have also been damaged, Cheema said.
The provincial administration has launched a relief operation and efforts are under way to make a full assessment of the damage. The epicentre of the earthquake was 200kms north-east of Peshawar.
According to Balakot police, the casualties occurred in Jabori, Jagghan Sahalia and Pagar of tehsil Balakot and parts of Mansehra district were badly affected.
The jolts were also felt in Rawalpindi, Peshawar, Muzaffarabad, Abbottabad, Haripur, Mansehra, Swat, Chitral and Mirpur, PTV reported.
According to Balakot police, several houses were partially damaged. More than seven houses collapsed in tehsil Balakot.