A powerful earthquake has struck a mountainous region in western China, killing at least four people and injuring scores of others, including schoolchildren in a stampede during the quake, officials said.

At least 54 were injured after the 5.9-magnitude quake hit near the county of Kangding in Sichuan province on Saturday.

A stampede at a primary school in Tagong town during the quake injured 42 children, according to the official Xinhua news agency state broadcaster CCTV.

A total of 30 homes collapsed and 2,630 suffered serious damage, the Sichuan information office said.

Western China is regularly hit by earthquakes, and reports said Saturday's quake could be felt in the Sichuan provincial capital of Chengdu on the plains below the Himalayan foothills.

Japan quake

In a separate development in neighbouring Japan, dozens of people were injured and many homes destroyed after an earthquake struck villages in central Japan.

Officials said on Sunday that the 6.7-magnitude quake destroyed at least 37 homes and injured 39 people, including seven severe cases, across a mountainous region.

The quake struck shortly after 13:00 GMT on Saturday west of Nagano city at a depth of 10km, the Japan Meteorological Agency said.

The hardest hit area appeared to be Hakuba, which had hosted events in the 1998 Winter Olympics. The village saw at least 30 homes destroyed and 17 people injured in the disaster, the Nagano prefecture government said.

Another seven homes were lost in Otari, a nearby village to the north. Non-residential buildings were also destroyed, with officials still assessing the damage.

Japanese television footage showed buildings in various states of collapse, some flattened and others leaning to one side, and deep cracks in the road.

About 200 people, mostly from Hakuba and Otari, were evacuated to shelters.

Shigeharu Fujimori, a Nagano prefecture disaster management official, said it was fortunate there have not been any deaths reported despite the extent of the damage.

Rescue operation

All 21 people trapped under collapsed homes were rescued, with two of them injured, the National Police Agency told Japan's Kyodo news agency.

Japanese television showed police going house to house Sunday morning, calling out to make sure that inhabitants were accounted for.

"The hardest-hit area was in the mountains and sparsely populated, where neighbors have a close relationship and help each other," Fujimori said.

"So I don't think anyone has been forgotten or left isolated."

Shinkansen bullet train service in the region was restored after a short interruption. Chubu Electric Power Co said about 200 homes were still without power on Sunday.

The quake was followed by more than 45 aftershocks, and Meteorological Agency official Yohei Hasegawa urged residents to watch out for landslides.