No Olympic Damage
The earthquake comes less than three months before the start of the Beijing Summer Olympics, when China hopes to use to showcase its rise in the world.
The earthquake also rattled buildings in Beijing, some 930 miles (1,497 kilometers) to the north.
Many Beijing office towers were evacuated, including the building housing the media offices for the organizers of the Olympics. None of the Olympic venues was damaged.
"I've lived in Taipei and California and I've been through quakes before. This is the most I've ever felt," said James McGregor, a business consultant who was inside the LG Towers in Beijing's business district. "The floor was moving underneath me."
In the Taiwanese capital of Taipei, 100 miles (161 kilometers) off the southeastern Chinese coast, buildings swayed when the quake hit. There were no immediate reports of injuries or damage.
A magnitude 7.8 earthquake is considered a major event, capable of causing widespread damage and injuries in populated areas.
The last serious earthquake in China was in 2003, when a magnitude 6.8 quake killed 268 people in Bachu County, west of Xinjiang.
China's deadliest earthquake in modern history struck the northeastern city of Tangshan on July 28, 1976, killing 240,000 people.