A magnitude 7.8 earthquake struck mountainous western China on Monday, toppling a primary school and killing four students, Chinese state media reported. The temblor, which was felt as far away as Vietnam and Thailand, injured more than 100 students in Chongqing in central China, the official Xinhua News Agency said. The quake struck 60 miles northwest of the Sichhuan provincial capital of Chengdu at 2:28 p.m., the US Geological Survey said on its Web site. It said the quake was centered 6.2 miles below the surface. The area has a population of about 110,000 residents, according to Xinhua. Chongqing is next to Sichuan. The government in Aba prefecture in Sichuan province said buildings had cracked and collapsed and mountain roads were damaged. Thousands of people were evacuated from buildings in Beijing, some 900 miles from the epicenter. Premier Wen Jiabao was headed to the epicenter, Xinhua said. Calls to emergency response numbers in Chengdu rang busy. A resident reached by phone in Chengdu said people flooded from buildings, but there was no sign of damage or injuries. According to the joint UN-European Commission's Global Disaster Alert and Coordination System, or GDAC, the quake struck in a sparsely populated area, but only about 50 miles from Chengdu. The city and surrounding areas are home to about 10 million people. An earthquake of this magnitude can cause damage as far away as 60 miles from the epicenter, it said. GDAC said a quake this strong could have a "high humanitarian impact" and spark deadly landslides. In the Chinese capital Beijing, about 930 miles away, buildings swayed for more than two minutes but there were no immediate reports of damage or injuries. Thousands of frightened office workers and shoppers evacuated buildings, including offices of the organizing committee for the Beijing Olympics. People lingered outside buildings in the central business district even a half-hour after the shaking stopped. In the Taiwanese capital of Taipei, 100 miles off the southeastern Chinese coast, buildings swayed when the quake hit. There were no immediate reports of injuries or damage. The quake was felt as far away as the Vietnamese capital of Hanoi, where some people hurried out of swaying office buildings and into the streets. A building in the Thai capital of Bangkok also was evacuated after the quake was felt there.