A 6.4 magnitude earthquake has struck a mountainous, rural area of Taiwan's south near the city of Chiayi, the island's weather administration says, with reports of minor damage.
Chipmaker TSMC said it had relocated staff from its factories in central and southern Taiwan, and they were all safe.
The quake shook buildings in the capital Taipei.
The quake had a depth of 9.4km with its epicentre in Dapu township in Chiayi county and hit shortly after midnight, the weather administration said.
The fire department said a handful of people were trapped in damaged buildings in the city of Tainan, and some had already been rescued.
The Chiayi fire department also said there were no reports of major casualties so far in the city while an official in Dapu, who gave his family name as Chi, told Reuters power cuts were reported in some villages and some buildings were damaged.
The Dapu fire department told Reuters there were no "obvious signs of disaster".
The science park in Tainan, home to major factories including of chipmaker TSMC, said buildings were evacuated.
Taiwan lies near the junction of two tectonic plates and is prone to earthquakes.
Taiwan's last major earthquake was in April when a 7.2 magnitude temblor hit the east coast county of Hualien, killing 13 people.
More than 100 people were killed in a quake in southern Taiwan in 2016 and a 7.3 magnitude quake killed more than 2000 people in 1999.