TAIPEI - A hotel on the east coast of Taiwan has collapsed after a 6.4-magnitude earthquake, with other buildings toppled or damaged, the national fire agency said, with reports people are trapped inside.

Images on local television showed the Marshal Hotel in Hualien slanted on its side, partially crumpled into the ground.

Media reports said there were 30 people trapped inside with others crawling to safety. The fire agency said at least four buildings including another hotel had toppled or been damaged, with televison images showing roads strewn with rubble and cracks in highways.

Port city Hualien is one of Taiwan's most popular tourist hubs as it lies on the picturesque east coast rail line and is near to popular Taroko Gorge.

Taiwan's president Tsai Ing-wen said rescuers from around the island were preparing to help.

"We will get into disaster relief work at the fastest speed," she said in a post on her Facebook page.

One Facebook livestream showed rescuers at the foot of the darkened Marshal hotel building and a crane carrying them up to the higher floors, which were leaning at an angle.

Officials from Hualien fire department said 28 people had been rescued from the hotel and a residential building.

They told AFP there was not yet any information on the number of people trapped or injured.

Photos on Apple Daily showed a man calling for help from the window of another building and wires dangling from the collapsed ceiling of a local hospital.

One Facebook user in Hualien told of damage around him. "The quake is so big... There are cracks on the wall, even the fridge moved," he said.

The quake hit at 23:50 pm (1550 GMT) around 21 kilometres (13 miles) northeast of Hualien, according to the United States Geological Survey.

It follows almost 100 smaller tremors to have hit the area in the last three days and comes exactly two years since a quake of the same magnitude struck the southern Taiwanese city of Tainan, killing more than 100 people.

Most of the death toll from the February 2016 earthquake was from the 16-storey Wei-kuan apartment complex, which toppled on its side with many of its residents buried in the rubble.

It was the only high-rise in Tainan to crumble completely in the quake, which came two days before Lunar New Year, when many people would have been visiting relatives for the biggest celebration of the Chinese calendar.

The safety of the building was called into question immediately after the disaster, when metal cans and foam were found to have been used as fillers in the concrete and residents said there had been cracks in the structure.

Five people were charged over the disaster, including the developer and two architects, with prosecutors saying they "cut corners" that affected the building's structural integrity.

Taiwan lies near the junction of two tectonic plates and is regularly hit by earthquakes.

The island's worst tremor in recent decades was a 7.6 magnitude quake in September 1999 that killed around 2,400 people.