Firefighters in Italy freed a 7-month-old baby and his older brother from rubble early Tuesday following a 4.0-magnitude quake on the resort island of Ischia off Naples, and rescuers were working on helping a third brother who remained trapped.

italy 2

This Monday, Aug. 21, 2017 photo shows a car amid debris following an earthquake in Casamicciola on the Italian resort island of Ischia (AP)

At least two people were killed in the quake that struck just before 9 p.m. (1900 GMT) Monday, while another 39 were injured and some 2,600 were left homeless. The victims were an elderly woman who was in a church that crumbled in the quake, and a second person who has been located in the rubble but not yet extracted.

Video released from the firefighting service showed rescuers passing the baby, who was wearing a white onesie and appearing alert, out of the collapsed structure in hardest-hit Casamicciola at around 4 a.m. The news agency ANSA said cries of joy went up in the crowd and the boys' mother ran to take him.

One of the baby's brothers was rescued some seven hours later, and quickly loaded onto a stretcher and into an ambulance.

A firefighter photo showed the boy, identified as Mattias, being pulled out of the rubble in just his underwear covered with cement dust. Firefighters said on Twitter that they had reached the other boy, named Ciro, and were working on extracting him.

italy quake 821c

Debris on a road after an earthquake hit the island of Ischia, near Naples, Southern Italy, Monday. (Mauro Iovino/ANSA via AP)

The children's father told RAI state television that boys were in a bedroom when the quake struck, while he and his wife were elsewhere in the house. The mother, who Italian media say is heavily pregnant, managed to escape through a window while rescuers helped the father.

Firefighter spokesman Luca Cari said they maintained voice contact with the two boys during the complex rescue operation to create an opening through the collapsed ceiling. The boys had been given bottles of water and a flashlight.

"We are in touch with both of the boys. We hear their voices and we are making ours heard to keep them calm," Cari was quoted by ANSA as saying.

The quake hit during the height of the tourist season, and Italian television showed many visitors taking refuge in parks following the quake. Authorities began organizing ferries to bring tourists back to the mainland early Tuesday.

Together with the nearby island of Capri, Ischia is a favorite island getaway for the European jet set, famed in particular for its thermal waters. Casamicciola was the epicenter of an 1883 earthquake that killed more than 2,000 people.

Images from the quake zone show many buildings collapsed into rubble, while others showed signs of structural damage with deep cracks in exterior walls. Cars were overturned.

The extent of the damage for a relatively light quake raised questions about the quality of construction on the island in the seismically active area off Naples and the active volcano, and the prevalence of illegally built structures.

italy 3

This Monday, Aug. 21, 2017 photo, shows people standing near a collapsed building following an earthquake in Casamicciola on the Italian resort island of Ischia. (AP)

Fabrizio Pistolesi, the head of Italy's national architecture advisory board, told SKY that many buildings on the island were built before seismic codes were adopted. He also cited the high incidence of illegal construction on Ischia and generally in the Campagna region that includes both the resort island and Naples.

"We know well that in Campagna, more than 200,000 homes were illegally constructed, we are talking about homes constructed in absolute scorn of seismic norms," he told Sky TG24.

Former Naples prosecutor Aldo De Chiara told Corriere della Sera that most of the recently constructed buildings on Ischia were built without necessary permits, and many with poor quality cement.

"We warned about the risk of collapses also in the case of not particularly serious temblors," De Chiara said. "Unfortunately, what we had denounced, happened last night."

The head of Italy's Civil Protection Agency, Angelo Borrelli, told reporters that 2,000 people had been left homeless in Casamicciola and another 600 in Lacco Ameno.  He said authorities were checking the stability of hotels to see if they could be used as temporary housing.

The quake came just two days shy of the one-year anniversary of a powerful 6.2-magnitude earthquake that devastated several towns in central Italy. The quake on Aug. 24, 2016 killed more than 250 people in Amatrice and beyond and set off a months-long series of powerful aftershocks that emptied many towns and hamlets of their people.