A powerful earthquake in southwest China has killed at 3,000 people and buried 900 teenagers in a collapsed school.

The death toll was expected to rise sharply as authorities and rescue teams make contact with the worst-hit areas of Sichuan province, where roads and phone lines have been cut off since the 7.8 magnitude quake struck.

The 900 students were buried in the rubble of a collapsed three-storey school building in the Sichuan city of Dujiangyan.

Rescuers were trying to retrieve survivors but details were still sketchy.

The 107 casualties occurred in the provinces of Sichuan, Gansu and Yunnan as well as Chongqing, a municipality of 30 million people that neighbours Sichuan, state media said.

The quake's epicentre was in the nearby Sichuan county of Wenchuan and its force caused buildings to sway across China and as far away as the Thai capital Bangkok.

Four more children died in a separate school collapse in Lirang township of Chongqing.

Another 10 died and 14 were seriously injured in the northwestern province of Gansu, Xinhua news agency's online edition said.

Buildings toppled in at least six counties near the epicentre, Xinhua said. Mountainous Wenchuan has a population of about 100,000 people.

In Beijing and Shanghai, office workers poured into the streets as the tremor hit. In the capital, which will host the summer Olympics in August, there was no visible damage and the showpiece Bird's Nest stadium was unscathed, the project's engineer told Xinhua.

But in Sichuan, phone lines in Wenchuan were completely cut and a website for the region's Aba prefecture said the quake had cut several major highways in the region and communications were down in 11 counties.

Premier Wen Jiabao has described the quake as a "disaster" and has rushed to the area while President Hu Jintao ordered an "all-out" rescue effort.

Thousands of army troops and paramilitary People's Armed Police carrying medical supplies were also headed to the region, state television said.

State television showed footage of residents in the Sichuan capital Chengdu, where the airport and railway station were closed, crowded in the streets looking relatively unscathed but for one woman shown bleeding from her head.

Foreign tourists in white bathrobes milled in a Chengdu street, apparently having fled their hotel. In some parts of the city, water and electricity were cut off, state radio said.

"The air-conditioning unit fell off the wall. Vases are all broken," a resident in Sichuan's Mianyang told the Reuters news agency.

"The sick in hospital have been moved outside to open fields. There is no electricity and no mobile phone reception. People are afraid of aftershocks."

The main quake struck at 06.28 GMT at a depth of 6 miles. An employee at the local newspaper in Mianyang said there had been several earthquakes. There have also been numerous aftershocks.

Xinhua said there was no immediate impact to the Three Gorges Dam project, the weight of whose massive reservoir, hundreds of miles from Chengdu, experts have said could increase the risk of tremors.