Three bodies have been found under the rubble of a block of flats which collapsed internally near Barcelona, the fire service said Wednesday after searching through the night for three missing residents.

"We have located three lifeless bodies in the collapsed building in Badalona, which are awaiting identification," the regional fire service wrote on X, formerly Twitter, almost 24 hours after the inner section of the five-storey residential block collapsed.

Speaking to local media, Xavier Garcia Albiol, mayor of Badalona, a seaside town just north of Barcelona, said the bodies were of a man and two women, one of whom was a mother of young children without giving further details.

The incident occurred around 10:30 am when the block suffered a so-called pancake collapse, a type of partial collapse when the floors fall successively onto the other.

It was not immediately clear what triggered the internal collapse which left the outer facade intact.

Footage from the roof released by the fire service showed a gaping hole running all the way to the ground floor.

The fire service said they were working to manually clear 60 cubic metres of rubble from the site, with 19 teams working through the night accompanied by sniffer dogs to try and find three residents who were unaccounted for.

In a posting on X, Badalona city council declared three days of mourning and said it would observe five minutes of silence at 5.30 pm in the main square.

Local media reports said the building, which contained 20 flats, had been constructed in 1959 and had recently passed a safety check.