(Adds China official postponing trip because of crash)
By Faith Hung and Michael Gold
TAIPEI, Feb 5 (Reuters) - Taipei's mayor hailed the pilot of a crashed TransAsia Airways plane a hero on Thursday for narrowly avoiding buildings and ditching the stalled aircraft in a river, likely averting a worse disaster.
At least 31 people were killed when Flight GE235 lurched between buildings, clipped a taxi and an overpass with one of its wings and crashed upside down into shallow water shortly after take-off from a downtown Taipei airport on Wednesday. There were 15 known survivors and 12 more unaccounted for.
"He really tried everything he could," Taipei Mayor Ko Wen-je said of the pilot, his voice breaking with sobs.
Amateur video recorded by a car dashboard camera showed the plane nose-up as it barely cleared the buildings close to Taipei's Songshan airport before crashing into the river.
"The pilot's immediate reaction saved many people," said Chris Lin, brother of one of the survivors. "I was a pilot myself and I'm quite knowledgeable about the immediate reaction needed in this kind of situation."
Aerospace analysts said it was too early to say whether the pilots intentionally pulled the plane above the buildings, and noted that the crew may have been aiming for the river to reduce casualties.
A more conclusive picture will emerge only when authorities release details from the plane's cockpit voice and flight data recorders, which were recovered on Wednesday.
"He's missed the buildings but it is premature to make an analysis of what happened on this flight. We have to wait for the data from the cockpit voice recorder and flight recorder," said aviation analyst Geoffrey Thomas, editor-in-chief of airlineratings.com
The pilot and co-pilot of the almost-new turboprop ATR 72-600 were among those killed, Taiwan's aviation regulator said. TransAsia identified the pilot as 42-year-old Liao Chien-tsung.
Taiwanese media reported that it appeared Liao had fought desperately to steer his stricken aircraft between apartment blocks and commercial buildings
The head of Taiwan's Civil Aeronautics Administration, Lin Tyh-ming, has said Liao had 4,914 flying hours under his belt and the co-pilot 6,922 hours.
Taiwanese media reported that Liao, the son of street vendors, passed exams to join the air force. He later flew for China Airlines, Taiwan's main carrier, before joining TransAsia.
The aviation regulator ordered TransAsia and Uni Air, a subsidiary of EVA Airways Corp, to conduct engine and fuel system checks on the remaining 22 ATR aircraft they still operate.
TransAsia's shares closed down 6.9 percent on Wednesday, its biggest percentage decline since late 2011, and were down another 3.3 percent on Thursday. The crash was the latest in a string of aviation disasters in Asia in the past 12 months and TransAsia's second in the past seven months.
Macau's Civil Aviation Authority said the engines of the plane had been replaced at Macau Airport on April 19 last year, during its delivery flight, "due to engine-related technical issues".
It said the engines were replaced by TransAsia engineers and the plane left Macau airport two days later.
Lin from Taiwan's CAA said the aircraft last underwent maintenance on Jan. 26.
The plane was powered by two Pratt & Whitney PW127M engines. Pratt & Whitney is part of United Technologies.
The last communication from one of the pilots was "Mayday engine flameout", according to an air traffic control recording on liveatc.net.
A flameout can occur when the fuel supply to an engine is interrupted or when there is faulty combustion, but twin-engined aircraft can usually keep flying with one engine.
Taiwan's United Daily reported that a flight attendant, identified only by her surname of Huang, told her family she had crawled out of the rear of the plane and found herself in the water. "I thought I was going to die," she said.
It also said a family of three who survived the crash had changed seats before take-off to the right of the plane, most likely saving their lives.
A TransAsia official said the airline would give the families of those killed T$1.2 million ($38,198) for funeral expenses and T$200,000 to each of the injured. Two people on the ground were also injured, it said.
The plane was bound for the Taiwan island of Kinmen.
Zhang Zhijun, a Chinese official forced to cut short his trip to Taiwan last year after he was pelted with paint by anti-China protesters, will delay a trip to Kinmen planned for Saturday because of the crash, the Taiwan government said.
$1 = T$31.4 Additional reporting by Siva Govindasamy in SINGAPORE and Yimou Lee in HONG KONG; Writing by Paul Tait and Emily Kaiser; Editing by Nick Macfie