Firefighters had been called to the 1960s block in the working class neighbourhood of Carabanchel before dawn to evacuate residents trapped in their homes after cracks appeared in the structure.
The cracks were first reported at around 4am when some neighbours heard creaking and found themselves unable to open doors within their apartments to escape the subsiding building.
“Some residents were evacuated through the front door while others who were not able to leave their flats because their doors were unhinged were evacuated using ladders through their windows,” said a statement from Madrid city hall.
Officials suspect the poor state of supporting pillars on the ground floor may be to blame.
Authorities said 57 residents had to be relocated from 40 separate flats within the block at number 5, Duquesa de Tamames Street as well as the neighbouring building which also showed signs of damage.
A video posted by Madrid authorities on YouTube shows the collapse of the Carabanchel block.
At around 9am on Monday, the entire rear of the property collapsed leaving only the façade standing.
Manuela Carmena, the newly elected left-wing mayor of Madrid visited the site during the morning and pledged a full investigation into the incident after visiting the scene on Monday.
El Ayuntamiento de @Madrid está brindando todo el apoyo a los y las vecinas de Carabanchel. Informaremos en rueda de prensa a las 12:30.
— Manuela Carmena (@ManuelaCarmena) August 3, 2015
Meanwhile residents of number 5 and the adjacent block have been put up in emergency accommodation including nearby hotels for those who do not have family nearby to temporarily lodge with.
Javier Barbero, Madrid’s councillor in charge of emergency services, said that a team of psychologists were on hand to treat those residents suffering anxiety.
“It is a very distressing situation for those who have lost their home,” he told a press conference at city hall.
One resident told Spanish newspaper El Pais that the cracks had appeared months ago, but got worse overnight.
“In June we moved some furniture and we saw a huge crack running from the ceiling to the floor,” said José Luis, who has rented an apartment in the building for ten years.
But his insurance company said there was no immediate danger and the repairs would be made in September, according to the newspaper report.