(Adds details from damaged building in Hualien, paragraph 3, updates number of aftershocks, paragraph 9, updates stock market reaction, paragraph 17)

TAIPEI, April 3 (Reuters) - A 7.2 magnitude earthquake rocked Taiwan on Wednesday, the strongest tremor to hit the island in at least 25 years, killing four people, injuring dozens and sparking a tsunami warning for southern Japan and the Philippines that was later lifted.

Taiwan's government said four people had died in the mountainous, sparsely populated eastern county of Hualien near where the epicentre was, with more than 50 injured.

At least 26 buildings have collapsed, more than half in Hualien, though in one of the worst damaged ones 22 people were rescued with only one missing, the fire department said.

Taiwan television stations showed footage of buildings at precarious angles in Hualien, where the quake struck just offshore around 8am (0000GMT) as people were going to work and school.

The quake had a depth of 15.5km (9.6 miles), according to Taiwan's Central Weather Administration.

"It was very strong. It felt as if the house was going to topple," said 60-year-old Taipei hospital worker Chang Yu-Lin.

Video showed rescuers using ladders to help people out of windows, while elsewhere, massive landslides caused by the tremors carved down hillsides.

Japan's weather agency said several small tsunami waves reached parts of the southern prefecture of Okinawa, and later downgraded the earlier tsunami warning to an advisory. It put the earthquake's magnitude at 7.7.

The Philippines Seismology Agency also issued a warning for residents in coastal areas of several provinces, urging them to evacuate to higher ground.

Taiwan also issued a tsunami warning, but reported no damage from that, and the Pacific Tsunami Warning Center in Hawaii later said the risk of damaging tsunami waves had passed.

Aftershocks could still be felt in Taipei, with more than 50 aftershocks registered, according to Taiwan's central weather administration.

Chinese state media said the quake was felt in China's Fujian province, while a Reuters witness said it was also felt in Shanghai.

The Taipei city government said it had not received any reports of major damage and the city's MRT was up and running soon after the tremor.

Electricity operator Taipower said more than 87,000 households in Taiwan were still without power, adding that the country's two nuclear power stations were not affected by the temblor.

Taiwan's high speed rail operator said no damage or injuries were reported on its trains, but noted trains will be delayed while it carries out inspections.

Semiconductor giant Taiwan Semiconductor Manufacturing Co , a major Apple and Nvidia supplier, said it had evacuated some fabrication plants and its safety systems were operating normally.

"To ensure the safety of personnel, some fabs were evacuated according to company procedure. We are currently confirming the details of the impact," according to the company.

It later added that those evacuated were beginning to return to their workplaces.

Taiwan's benchmark share index largely brushed off the impact of the earthquake, closing down 0.6%. TSMC's Taipei-listed shares ended down 1.3%.

Taiwan's official central news agency said the quake was the biggest to hit the island since 1999 when a 7.6 magnitude tremor killed around 2,400 people and destroyed or damaged 50,000 buildings in one of Taiwan's worst-recorded quakes.

Taiwan's Central Weather Administration said the earthquake registered the second-highest intensity of an "Upper 6" in Hualien county, on the 1-7 intensity scale.

In an Upper 6 earthquake, most unreinforced concrete-block walls collapse and people find it impossible to remain standing or move without crawling, the Japan Meteorological Agency says.

(Reporting by Ben Blanchard, Yimou Lee, Shanghai and Hong Kong newsrooms; Writing by Bernard Orr; Editing by Lincoln Feast)