The quake’s epicenter was just off the coast of Yilan county, at a depth of 72.2 km (44.9 miles), according to the island’s Central Weather Bureau.
Taipei’s subway system was operating as normal, the city government said.
Taiwan lies near the junction of two tectonic plates in the South China Sea 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.
By Ben Blanchard and Yimou Lee