Rescuers are seen entering a building that collapsed onto its side from an early morning 6.4 magnitude earthquake in Hualien County, eastern Taiwan, Wednesday, Feb. 7 2018. Rescue workers are searching for any survivors trapped inside the building. (AP Photo/Tian Jun-hsiung)

A magnitude-6.4 earthquake struck Tuesday near the coast of Taiwan, killing two people and injuring more than 200 others, officials said.

The ground floor of the Marshal Hotel in Hualien county caved in, causing the death of one employee. Another person died in a residential building, the national fire and rescue service reported.

Other buildings shifted on their foundations and rescuers used ladders, ropes and cranes to get residents to safety.

Taiwanese media reported that a separate hotel known as the Beautiful Life Hotel was tilting. The agency also posted photos showing a road fractured in several parts.

Bridges and some highways were closed pending inspections after buckling due to the force of the quake.

With aftershocks continuing, shell-shocked residents were being directed to shelters, including a newly built baseball stadium, where beds and hot food were provided.

Speaking from a crisis center in Taipei, Cabinet spokesman Hsu Kuo-yung said rail links appeared to be unaffected and the runway of Hualien airport was intact.

"We're putting a priority on Hualien people being able to return home to check on their loved ones," Hsu said.

The U.S. Geological Survey said the quake struck late Tuesday about 21 kilometers (13 miles) northeast of Hualien, on the island's east coast. It occurred at a depth of about 9.5 kilometers (6 miles).

In this photo released by Hualien County Fire Bureau, debris around a building that collapsed onto its side following an early morning earthquake in Hualien County, eastern Taiwan, Wednesday, Feb. 7 2018. A 6.4-magnitude earthquake has struck eastern Taiwan. (Hualien County Fire Bureau via AP)

The earthquake followed one over the weekend off the coast of Hualien, which lies along the famed "Pacific Rim of Fire" known for seismic activity from Alaska to Southeast Asia.

The quake came exactly two years after a magnitude-6.4 quake struck southern Taiwan, causing the collapse of an apartment complex and the deaths of 115 people.

Five people involved in the construction of the complex were later found guilty of negligence and given prison sentences.

A magnitude-7.6 quake in central Taiwan killed more than 2,300 people in 1999.

Earthquakes rattle Taiwan frequently. Most are minor and cause little or no damage,

  • In this photo released by Hualien County Fire Bureau, debris around a building as rescue workers gain entry after the building collapsed onto its side following an early morning earthquake in Hualien County, eastern Taiwan, Wednesday, Feb. 7 2018. A 6.4-magnitude earthquake has struck eastern Taiwan. (Hualien County Fire Bureau via AP)

  • In this image from TV, emergency services attend after a building collapsed on its side, as a man climbs a ladder to gain access to the building, centre background, after an early morning earthquake in Hualien County, eastern Taiwan, early Wednesday, Feb. 7 2018. A magnitude-6.4 earthquake struck late Tuesday near the coast of Taiwan, and people may be trapped inside the building. (EBC via AP)

  • In this photo released by Hualien County Fire Bureau, rescuers are seen entering an building that collapsed onto its side from an early morning earthquake in Hualien County, eastern Taiwan, Wednesday, Feb. 7 2018. A 6.4-magnitude earthquake has struck eastern Taiwan, according to the U.S. Geological Survey. (Hualien County Fire Bureau via AP)

  • In this image from TV, emergency services attend after a building collapsed onto it's side, following an earthquake in Hualien County, eastern Taiwan, early Wednesday, Feb. 7, 2018. A magnitude-6.4 earthquake struck late Tuesday near the coast of Taiwan, and people may be trapped inside the building. (EBC via AP)

  • In this photo released by Hualien County Fire Bureau, Taiwanese people watching a building that collapsed on its side from an early morning earthquake in Hualien County, eastern Taiwan, early Wednesday, Feb. 7 2018. A 6.4-magnitude earthquake has struck eastern Taiwan, according to the U.S. Geological Survey. (Hualien County Fire Bureau via AP)