The quake had a depth of 27.5 km (17.1 miles) with its epicenter 89.5 km (55.6 miles) off Taiwan's east coast, roughly halfway between the coast of Hualien county and the southern Japanese island of Yonaguni, the weather bureau said.
The quake could be felt across Taiwan, it added, Reuters news agency reported.
Taiwan lies near the junction of two tectonic plates and is prone to earthquakes.
More than 100 people were killed in a quake in southern Taiwan in 2016, while a 7.3 magnitude quake killed more than 2,000 people in 1999.
MA/PR