Media playback is unsupported on your device Media caption A local resident captured the blasts in dramatic mobile phone footage

Massive explosions have hit China's northern city of Tianjin, leaving at least 17 people dead and hundreds more injured.

State media said the blasts happened in a warehouse storing "dangerous and chemical goods" in the port area of the city.

Pictures and video on social media showed flames lighting up the sky, and buildings are said to have collapsed.

Hospitals are reported to be overwhelmed with casualties.

President Xi Jinping has urged "all-out efforts" to rescue victims and contain the fire, Xinhua state news agency said.

Image copyright EPA Image caption Daylight revealed the extent of the devastation in Tianjin

Image caption Buildings and hundreds of cars in the port area were destroyed

Image caption Workers' dormitories in the port area were also destroyed

State broadcaster China Central Television (CCTV) said a shipment of explosives had detonated but this was not confirmed.

State media also said senior managers of Ruihai Logistics, which owned the warehouse where the explosion took place, were being questioned by authorities.

The first explosion at about 23:30 (15:30 GMT) on Wednesday was followed by another, more powerful blast, seconds later. Shockwaves were felt several kilometres away.

BBC Chinese Service editor Raymond Li says all indications are that it was an industrial accident.

At the scene: John Sudworth, BBC News, Tianjin

The apartment complex closest to the explosion has eight rows of high-rise tower blocks.

In every one of them, almost every window has been blown out. On the ground outside are the signs of the many families who have fled from their beds in a hurry - a woman's shoe, children's toys, mangled bicycles.

There would have been many injured here. Inside the homes, furniture has been picked up as if by a whirlwind and interior doors lie at angles, ripped off their hinges.

It may be a long time before the cause of the explosion is known. Such is the scale of this disaster that for now, the authorities are simply struggling to achieve an accurate account of the numbers of dead and injured.

Travelling into Tianjin blast zone

Blast 'like end of the world'

Tianjin pictures reveal devastation

The China Earthquake Networks Centre said the magnitude of the first explosion was the equivalent of detonating three tons of TNT, while the second was the equivalent of 21 tonnes of the explosive.

Further blasts were subsequently triggered nearby, Xinhua said.

CCTV said four firefighters were among the dead and that more than 400 people had been injured, at least 32 of them critically.

Media playback is unsupported on your device Media caption Debris is seen amidst billowing smoke at the explosion site in Tianjin

Media playback is unsupported on your device Media caption The BBC's Rico Hizon reports on how social media spread the news about the Tianjin explosion

BBC producer Xinyan Yu, who is in Tianjin, said workers' dormitories were among the buildings destroyed.

Hours later, fires were still burning and 100 fire engines were at the scene, reported CCTV.

One witness, named only as Ms Yang, told local media she was out shopping when "suddenly from behind there was a big fireball and explosion".

Image copyright EPA Image caption Fires were still burning hours after the explosions

Image copyright AP Image caption The initial fireball lit up the sky above Tianjin

Image copyright AFP Image caption People went down on to the streets seeking shelter after the blasts

Image copyright Reuters Image caption Some seemed dazed, others distraught

Image copyright Reuters Image caption The force of the blasts shook buildings and set parked vehicles alight

"At the time of the explosion the ground was shaking fiercely, nearby cars and buildings were shaking, glass from a few buildings all broke and everyone started to run," she said.

"Now all the residents are gathered in the street."

Another witness, Canadian teacher Monica Andrews, told how she woke in panic after what she thought was an earthquake.

Media playback is unsupported on your device Media caption Eyewitness: "I woke in a panic"

"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. It was crazy," she told the BBC.

China National Radio said cracks were visible in buildings near the site of the blast.

Several tower blocks near the port area are without power, CCTV added.

Tianjin, home to some 15 million people, is a major port and industrial area to the south-east of the Chinese capital, Beijing,