HONG KONG — A powerful earthquake struck Taiwan just before midnight on Tuesday, damaging buildings in the city of Hualien, killing four people and leaving an additional 145 missing, according to the authorities.

The 6.4-magnitude quake was recorded at 11:50 p.m. and was centered about 14 miles northeast of Hualien, a city of 110,000 on Taiwan’s east coast, the United States Geological Survey reported.

At least 225 people were injured, according to the Hualien County disaster response center. The National Fire Agency said 149 people had been pulled from the rubble. It said that 40,000 people were without water, and 645 without electricity.

Most of the missing are believed to be trapped in a damaged building in downtown Hualien, the county disaster response center said.