The toll from an earthquake that struck southwest China's Yunnan province rose to 22 dead and 106 injured on Sunday, with more than 6,000 homes demolished, officials and press reports said.

The quake which struck mountainous Yanjin county early Saturday measured 5.1 on the Richter scale, with most victims killed by collapsing homes and falling rocks, they said.

"The toll has risen to 22 dead and 106 injured," a spokesman surnamed Cao at government offices in Zhaotong city, which oversees Yanjin county, told AFP by phone.

"This morning (Sunday) we had an aftershock which measured 1.9 on the Richter scale.

"Rescue and relief efforts are ongoing."

Xinhua news agency said another 38,000 buildings were damaged by the quake which shook 13 townships in the region.

Tons of rocks also fell onto a major railway line linking Yunnan to Sichuan province, blocking the line for much of Saturday, China Central Radio reported.

Up to 6,000 buildings in the disaster area collapsed while 9,000 other buildings were in danger of collapsing following the quake, the report said.

"The most important thing is to keep the losses to a minimum," Yanjin county head Cheng Lianyuan told the radio station.

"Secondly we have to arrange accommodations for the victims and make sure that the injured are attended to."

The seriously injured have been hospitalized, while the government has sent in tents, food and water and reestablished communication and power links, he said.

Most of the dead were killed by collapsing buildings or falling rocks, officials said.

"Some were crushed inside their homes, others were killed by rocks falling from the mountains," a Yanjin county earthquake administration official told AFP.