The Central Meteorological Bureau traced the epicenter of the quake to Yilan District in the northeast of the country, and said it struck at a depth of 67 kilometers at 11:13 am (0511 GMT).
An Agence France-Presse correspondent in Taipei reported that the tremor lasted about 30 seconds and was felt.
No damage was recorded in his neighborhood.
The quake was followed by a 5.4-magnitude aftershock, and the subway system in Taipei was suspended as a precaution for just under an hour before service resumed.
Tom Parker, a British painter who lives in Taipei, said he was taking the subway when the quake struck.
“It’s the first time I’ve felt an earthquake in the subway. It’s like being on a roller coaster,” he wrote on Twitter, adding that he and other passengers had been asked to take cover at the station for the time being.
Several other people reported the earthquake on social networks.
“I was so scared, I screamed in my room,” Yu Ting wrote on Facebook. “This earthquake is really strong, the glass in the living room shattered.”
Some grocery stores reported that food and other goods fell off shelves due to vibration.
AFP quoted the authorities as saying they did not expect widespread damage because the quake was not superficial.
“There is no need to worry too much,” said Chen Kuo-chang, head of the Seismological Center of the Central Meteorological Bureau.
Taiwan experiences earthquakes regularly, as the island is located near the intersection of two tectonic plates.
Earthquakes of this magnitude can be fatal.
In 2018, a 6.4-magnitude earthquake hit Hualien City, a popular tourist attraction, killing 17 people and injuring nearly 300.
In September 1999, a 7.6-magnitude earthquake killed nearly 2,400 people in the most deadly natural disaster in the island’s history.
In December 2020, a 6.2-magnitude earthquake struck Yilan, with no major damage or injuries reported.
.