Taipei city’s government said there was no major damage reported in the immediate aftermath, with some isolated cases of damage including gas and water leakage and minor damage to buildings.
More than 3,000 homes in Yilan briefly lost power, Taiwan Power Company said.
Major chipmaker TSMC said a small number of its facilities in the northern Hsinchu Science Park met evacuation thresholds after the quake and evacuated staff had since returned to their posts.
The weather administration said people should be on alert for aftershocks between 5.5 and 6.0 in the coming day. It also said damage from the quake should be limited because it was relatively deep and hit offshore.
Taiwan President Lai Ching-te said in a social media post that authorities had the situation under control and also urged the population to be on alert for aftershocks.