The eighth and final body has been pulled from the rubble of a five-story building that collapsed in Italy.

Digging through the debris for victims ended more than 24 hours after the apartment block collapsed in the early morning on Friday in a seaside town south of Naples.

The dead were identified as an elderly resident and two families, one with children, and one with an adult son living at home.

Police are investigating the cause of the collapse, but said it may be linked to renovation work on the building.

The scenic railway line that connects Naples with the nearby Pompeii archaeological site and the Amalfi coast remained closed.

Emergency services worked through the night to find survivors Credit: AP

Witnesses said there was no explosion before the collapse but that a train had just passed by.

The Italian railway said vibrations from the train have no impact on adjacent buildings because they are absorbed by ballast.

Carabinieri, the Italian police force which is part of the army, were the first to respond to the collapse at 6:30am as many residents still slept, digging by hand to find survivors.

Carabinieri Marshall Francesco Murciano said: "We intervened immediately. We found ourselves before a chilling scene. We started to dig with our bare hands, without any tools."

The work continued for hours by hand until heavier equipment arrived, while sniffer dogs checked for signs of life.