At least 20 people were killed and more than 100 injured on Thursday when an earthquake struck southwestern Pakistan, causing roofs and walls of mud brick homes to collapse on families as they slept.

A one-year-old boy was among the victims, killed when a beam crashed on top of him in the darkness, as the 5.9-magnitude quake jolted at least six cities and towns in Balochistan province.

Map locating a 5.7 magnitude earthquake that hit southern Pakistan in the early hours of Thursday.
Map locating a 5.7 magnitude earthquake that hit southern Pakistan in the early hours of Thursday. AFP / STAFF

The worst-affected area was the remote mountainous district of Harnai, where landslides blocked some roads, hampering initial rescue efforts.

"The roof of my house collapsed, when I regained consciousness, I pulled out two of my sons, but the youngest one... had already died," survivor Rafiullah, a farmer from a village in Harnai district, told AFP.

The first burials, including that of two children, have already taken place, AFP journalists witnessed. Under Islamic tradition, burials take place as quickly as possible after death.

Many of the victims died when the roofs and walls of their mud houses collapsed after the quake struck in darkness
Many of the victims died when the roofs and walls of their mud houses collapsed after the quake struck in darkness AFP / Banaras KHAN

Army helicopters helped to evacuate the injured from Harnai district to Quetta, the nearest major city.

Suhail Anwar Hashmi, the top government official in Harnai district, told AFP six children were among the dead, putting the number of injured at around 200.

The quake caused electricity to fail in the area, with health staff working until dawn without lights in the district's poorly equipped government hospital
The quake caused electricity to fail in the area, with health staff working until dawn without lights in the district's poorly equipped government hospital AFP / Banaras KHAN

"It is safe to say that hundreds of mud houses were damaged," said Balochistan's home minister Mir Zia ullah Langau, putting the death toll at 20 with more than 100 injured.

Rescue teams rushed to clear roads so emergency authorities could reach remote areas affected by the quake, which also caused electricity to fail.

Aftermath scenes in Pakistan's Harnai town after a shallow earthquake hit the country's southwest in the early hours of Thursday. The tremor left at least 20 people dead and dozens injured as of Thursday afternoon.
Aftermath scenes in Pakistan's Harnai town after a shallow earthquake hit the country's southwest in the early hours of Thursday. The tremor left at least 20 people dead and dozens injured as of Thursday afternoon. AFPTV

Before daybreak, "we were operating without electricity with the help of torches and mobile flashlights," Zahoor Tarin, a senior official at Harnai hospital, told AFP.

"Most of the injured came with fractured limbs. Dozens of people were sent back after first aid," he said.

Prime Minister Imran Khan said he had ordered "immediate assistance on an emergency basis" to the affected region.

US Deputy Secretary of State Wendy Sherman, who was due to arrive in Islamabad on Thursday evening to meet with Pakistani officials, offered her condolences to the families affected.

The earthquake was felt in towns throughout Balochistan, which borders Afghanistan and Iran, including provincial capital Quetta, around 170 kilometres (105 miles) west of Harnai.

Hashmi, the top government official in Harnai district, said a rescue team had been dispatched to investigate reports that coal miners were trapped in a mine on the outskirts of the town, but officials later said the mines had not been damaged.

The US Geological Survey initially said the shallow quake measured 5.7, before revising it up to a magnitude of 5.9.

Pakistan straddles the boundary where the Indian and Eurasian tectonic plates meet, making the country susceptible to earthquakes.

The country was also hit by a 7.6-magnitude quake in 2005 that killed more than 73,000 people and left about 3.5 million homeless, mainly in Pakistan-controlled Kashmir.