TAIPEI: A powerful earthquake in Taiwan felled a 16-storey apartment complex full of families who had gathered for Lunar New Year celebrations Saturday, with at least seven dead and more than 30 feared trapped.

The death toll was rising in the historic city of Tainan, which bore the brunt of the 6.4-magnitude quake, as rescuers scoured rubble for survivors.

An entire residential complex of four buildings containing almost 100 homes toppled, left on its side with twisted metal girders exposed and clouds of dust rising from the jumbled concrete.

Among the seven dead was a 10-day old baby girl, the National Fire Agency said — she was one of five people who were killed when the apartment complex collapsed.

The other two victims were killed in different parts of the city by falling debris, the agency said.

Officials say they are unsure how many residents may still be inside, but media reports estimated at least 30 could be trapped.

Around 400 troops have been mobilised to help the rescue effort.

Residents at the 16-storey felled Wei-kuan Building told of their terror as the quake hit, with survivors pulled bleeding and crying from the ruins, some just in their underwear.

"I saw buildings shake up and down and left and right," said one resident.

"The first and second floor just collapsed and I smelt gas and water was leaking," he told local channel SET TV.

Another man tied his clothes together to create a rope and lowered himself from his home on the ninth floor to the sixth floor below, Apple Daily reported.

One woman told how she had fought her way out of her home.

"I used a hammer to break the door of my home which was twisted and locked, and managed to climb out," she told SET TV, weeping as she spoke.

Rescuers have freed more than 200 people from the apartment complex, with over 40 of them hospitalised.

Interior minister Chen Wei-jen said he feared there may be more people in the building than usual as family members would have returned to celebrate the Lunar New Year holidays next week.

"Exactly how many people were there when the quake hit was not immediately clear," said Chen.

"We are concerned that most members of those families may have returned for the coming new year holiday."

Officials said there were 256 people registered as living in the complex, which contained 96 apartments.

Dazed and exhausted residents stood outside the toppled buildings, watching rescue workers free survivors — from infants to the elderly, some strapped to stretchers — and carefully hand them down ladders.

"(The building) shook up and down. I was terrified and my wife and I held each other. We thought we weren't going to make it," one resident told TVBS.

Eight shelters have been set up around the city, with over 100 people taking refuge there.

As Premier Chang San-cheng visited the disaster zone, one elderly woman wept, saying her son, daughter-in-law and grandchildren were still trapped on the 15th floor, Apple Daily reported.

President Ma Ying-jeou also visited Tainan to be briefed by city officials.

Cranes towered over the zone with diggers trying to remove slabs of concrete.

Separately, at least 30 people were earlier freed from another residential seven-storey tower, with officials saying several blocks had collapsed or half collapsed in other parts of the city, with some buildings left leaning at alarming angles.

China has offered rescue assistance if needed, according to state news agency Xinhua.

Across Tainan, 316 people were injured, with more than 60 hospitalised, officials said, but the search and rescue operation was focused purely on the Wei-kuan complex.

The shallow quake struck at a depth of 10 kilometres (six miles) at around 4am (2000 GMT Friday), 39 kilometres northeast of Kaohsiung, Taiwan's second-largest city and an important port.

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

A strong 6.3-magnitude quake that hit central Taiwan in June 2013 killed four people and caused widespread landslides.

A 7.6-magnitude quake struck the island in September 1999 and killed around 2,400 people.--AFP

Rescue personnel work on damaged buildings after an earthquake in Tainan. REUTERS
Rescue personnel work on damaged buildings after an earthquake in Tainan. REUTERS
Soldiers prepare to rescue people trapped in a collapsed building. EPA
Soldiers prepare to rescue people trapped in a collapsed building. EPA
A building is damaged from an earthquake in Tainan. REUTERS
A building is damaged from an earthquake in Tainan. REUTERS
 Tsai Min-chien, a member of the Seismological Observation Centre, explains a map to journalists after three earthquakes measuring 6.4, 4.3 and 4.5 respectively hit southern Taiwan. EPA
Tsai Min-chien, a member of the Seismological Observation Centre, explains a map to journalists after three earthquakes measuring 6.4, 4.3 and 4.5 respectively hit southern Taiwan. EPA
 A handout image provided by the US Geological Survey (USGS) shows a shakemap of a 6.4 magnitude earthquake detected in a depth of 10 kilometers some 22 kilometers northeast of Pingtung, Taiwan. EPA
A handout image provided by the US Geological Survey (USGS) shows a shakemap of a 6.4 magnitude earthquake detected in a depth of 10 kilometers some 22 kilometers northeast of Pingtung, Taiwan. EPA
Firemen rescue a man from a collapsed house in Tainan City. EPA
Firemen rescue a man from a collapsed house in Tainan City. EPA
Rescue personnel help a victim at a damaged building. REUTERS
Rescue personnel help a victim at a damaged building. REUTERS
Rescuers carry a survivor from a collapsed building. EPA
Rescuers carry a survivor from a collapsed building. EPA
Rescue workers remove a baby from the site where a 17-storey apartment building collapsed after an earthquake hit Tainan. REUTERS
Rescue workers remove a baby from the site where a 17-storey apartment building collapsed after an earthquake hit Tainan. REUTERS