Three people were confirmed dead and 16 were still missing early Thursday after three office buildings, one of them 20 stories high, collapsed in downtown Rio de Janeiro, authorities said.

Officials in Brazil's second largest city said the three bodies were retrieved as rescue teams with search dogs and heavy clearing equipment sifted through the rubble.

Rio state security officials said six people were hurt, including a woman who sustained head injuries and required surgery.

The collapse, apparently caused by structural problems, occurred late Wednesday as Brazil races to prepare to host the 2014 World Cup and 2016 Summer Olympics, events which it hopes will highlight the country's emerging economic and political prowess.

It took place near the municipal theater on the city's Cinelandia square, in a historic district bustling by day but nearly deserted at night.

Witnesses reported hearing an explosion and described scenes reminiscent of September 11, 2001, with walls of dust and debris.

A special team was set up in the Rio municipal assembly office to assist relatives of the missing.

"Three buildings collapsed: a 20-story building, a 10-story building and a smaller building of three or four floors," Rio Mayor Eduardo Paes told reporters late Wednesday, adding that "giving a total number of victims would be pure speculation."

Health Secretary Sousa Aguiar said the office buildings would have been largely deserted during the night-time collapse.

Paes said the cause was not yet known, but that it was likely "structural problems."

But police spokesman Rodrigo Pimentel told reporters Thursday that "illegal" work had been taking place in the 20-story building.

"This may have affected the structure of the building. Construction material was also stored inside and this could ave caused a breakup of the structure," he added.

"The breakup occurred suddenly, without early sign of cracks."

Civil defense teams inspected nearby buildings, and area metro stations which had been closed reopened Thursday after thorough checks, officials said.

However a nine-story building in an adjacent street was evacuated as a precautionary measure.

Allesandro da Silva Fonseca, who was briefly trapped in an elevator while he tried to escape with four other construction workers, said he almost suffocated from the dust.

"I was out of air. I could not breathe," he told AFP by mobile phone. All five workers later managed to escape, but it was not immediately clear if they were the same victims referred to by health officials.

A mountain of rubble filled the street, and thick dust covered nearby cars. The tallest building had housed several law offices, and construction work was being carried out on two separate floors.

A bank branch and a restaurant were located on the first floor of one of the buildings, but it was not immediately clear if the two businesses were open at the time of the collapse.

Brazilian authorities are racing to build or renovate 12 stadiums in time for the 2014 World Cup, one of the world's premier sporting events.

Last month football's ruling body FIFA warned Brazil about delays in the progress of construction projects expected to be ready for the four-yearly extravaganza.

The Getulio Vargas Foundation and consultancy Ernst & Young have said Brazil needs more than $11 billion in investment to fix roads, boost hotel capacity, reinforce security and develop its telecom network ahead of the World Cup.

Brazil hopes the events will showcase its rising power. The Latin American giant surpassed Britain as the world's sixth largest economy last year, but its standard of living lags behind that of the United States and Europe.