(Adds details, changes dateline)
By Joseph Campbell
TIANJIN, China, Aug 13 (Reuters) - Two massive explosions caused by flammable goods ripped through an industrial area in the northeast Chinese port city of Tianjin late on Wednesday, killing 17 people and injuring as many as 400, official Chinese media reported.
Authorities had lost contact with 36 firefighters on the scene, the official Beijing News newspaper reported, citing the Tianjin fire department.
The force of the explosions unnerved residents across much of the city of 15 million people, with some posting videos on the Internet that showed giant fireballs shooting into the sky and shockwaves buffeting apartment blocks and cars.
Fires were still burning after dawn, with photographs on Chinese news websites showing what appeared to be several destroyed buildings as well as torched cars at a multi-storey car park inside a logistics base at Tianjin Port. The port, one of the busiest in China, was operating normally, a port official said.
President Xi Jinping demanded that authorities quickly extinguish the fires and "make full effort to rescue and treat the injured and ensure the safety of people and their property", China Central Television (CCTV) said on its official microblog.
CCTV said the blasts erupted in a shipment of explosives at around 11:30 p.m. local time (1530 GMT), triggering a shockwave that was felt kilometres (miles) away. The second blast came roughly 30 seconds after the first, state media said.
Video posted on YouTube from what appeared to be an apartment building some distance from the scene showed fire shooting into the night sky from the initial blast when the second, much bigger, explosion rocked the area, sending a huge fireball into the air.
Seconds later, shockwaves hit the apartment building.
"Our building is shaking. Is this an atomic bomb?" said a frenzied voice inside.
In other amateur video which appears to be shot closer to the scene, people scream from inside a car as the shockwave hits from the second blast, rocking their vehicle.
The official People's Daily newspaper said the death toll was 17 while other state media said six firefighters were among the dead.
The official Xinhua news agency gave varying estimates of between 300 and 400 injured, with 32 critically hurt.
Xinhua said the explosions ripped through a warehouse storing "dangerous goods". The first explosion was equivalent to 3 tonnes of TNT and the second blast 21 tonnes of TNT, it said.
It identified the owner of the warehouse as Tianjin Dongjiang Port Ruihai International Logistics.
The company's website said it was a government-approved firm specialising in handling "dangerous goods". Company officials could not immediately be reached for comment.
Canadian teacher Monica Andrews told the BBC that she awoke in panic after what she thought was an earthquake.
"I ... looked out the window and the sky was red ... I just watched a second explosion go off and (it was) just pure chaos, everyone leaving their apartment buildings thinking it's an earthquake, cars trying to leave the complex and ... it was crazy the amount of light that this explosion and fire lit up," she said.
Pictures posted on Chinese media websites also showed residents and workers, some bleeding, fleeing from near the scene. Citing a local hospital, Xinhua said people had been hurt by broken glass and stones.
CCTV said on its website about 100 fire trucks had been sent to the scene. Several fire trucks had been destroyed and nearby firefighters wept as they worked to extinguish flames, the Beijing News said.
Tianjin is home to around 15 million people, making it one of the biggest cities in China.
Industrial accidents are not uncommon in China following three decades of breakneck economic growth. A blast at an auto parts factory in eastern China killed 75 people a year ago when a room filled with metal dust exploded. (Additional reporting by Kazunori Takada and Chen Yixin in SHANGHAI and Michael Martina in BEIJING; Writing by Dean Yates; Editing by Raju Gopalakrishnan)