Authorities did not give details on the severity of the injuries suffered by survivors.

Five people were killed on Thursday when the roof of a Shanghai commercial building caved in upon construction workers who were renovating it, the city government said.

The accident occurred at around 11:30 am (0330 GMT) in a central Shanghai neighbourhood, trapping around 20 people, according to fire rescue officials.

Official sources provided differing tallies of the numbers of people pulled out of the rubble throughout the day, but both the city government and the national emergency ministry now quote a death toll of five.

A verified social media account run by China's emergency ministry showed pictures of rescue personnel digging bloodied and dust-coated workers out from amid piles of rubble, toppled concrete pillars and shattered wooden beams.

Authorities did not give details on the severity of the injuries suffered by survivors.

Police quickly sealed off the area with a huge security presence, preventing journalists from getting close.

The building had previously been used as a dealership for Mercedes-Benz cars, the fire rescue bureau said.

It was being redeveloped as a mixed-use arts and innovation site, according to Chinese media reports.

A local resident told news agency AFP she was taking a nap when her bed suddenly began shaking, as if in an earthquake had struck. She then heard a loud bang.

"I thought it was an explosion at first," said the woman, who declined to give her name or to comment further.

Chinese media reports said the structure was around 3,000 square metres (32,000 square feet) in area. Aerial pictures on social media appeared to indicate that the roof of about half of the building collapsed.

China has seen numerous building collapses in recent years, typically blamed on the country's rapid growth leading to corner-cutting on construction, and the flouting of safety rules.

At least 20 people were killed in 2016 when a series of crudely-constructed multi-storey buildings that were packed with migrant workers collapsed in the eastern city of Wenzhou.