IZMIR, Turkey -- Three young children and their mother were rescued alive from the rubble of a collapsed building in western Turkey on Saturday, some 23 hours after a powerful earthquake in the Aegean Sea killed at least 39 people and injured more than 800 others. One of the children died soon after being rescued, while a fourth child was still trapped.

The Friday afternoon quake that struck Turkey's Aegean coast and north of the Greek island of Samos registered a magnitude that Turkish authorities put at 6.6 while other seismology institutes said it measured 6.9. It toppled buildings in Izmir, Turkey's third-largest city, and triggered a small tsunami in the Seferihisar district and on the Greek island. Hundreds of aftershocks followed.

At least 37 people were killed in Izmir, Turkish President Recep Tayyip Erdogan said from a crisis co-ordinationcentre before visiting the wrecked sites. Among them was an elderly woman who drowned in the tsunami. But rescue teams on Saturday made contact with 38-year old Seher Perincek and her four children -- ages 3, 7 and 10-year-old twins -- inside a fallen building in Izmir and cleared a corridor to bring them out.

One by one, the mother and three of her children were removed from the rubble as rescuers applauded or hugged.

The survivors, including 10-year-old Elzem Perincek, were moved into ambulances on stretchers.

"I'm fine; I was rescued because only one of my feet was pinned. That foot really hurt," she said.

The health minister as well as rescue worker Ahmet Yavuz told HaberTurk television hours later that one of the children had died after being rescued. They were still trying to reach the other child, Yavuz said.

More than 5,500 rescuers from different agencies and cities worked together to reach survivors, at times hushing the crowds to listen into the rubble with sensitive headphones and crawling through the cracks. A 65-year-old man was saved 26 hours after the quake. Rescue work continued in nine buildings.

Earlier Saturday, search-and-rescue teams lifted teenager Inci Okan out of the rubble of a devastated eight-floor apartment building. Her dog, Fistik, or Pistachio, was also rescued, Turkish media reported.

A video showed a female rescuer trying to calm down the 16-year-old girl under the rubble as she inserted a catheter. "I'm so scared," the girl cried. "Can you hold my hand?"

"We are going to get out of here soon," the rescuer, Edanur Dogan, said. "Your mother is waiting outside for you."

Two other women, aged 53 and 35, were brought out from the rubble of another toppled two-story building earlier on Saturday.

Some 103 people have been rescued since the earthquake, Erdogan said. It was unclear how many more people were trapped under buildings that were levelled.

Turkey's Disaster and Emergency Management Presidency, or AFAD, said 885 people were injured in Izmir and three other provinces. The health minister said eight people were being treated in intensive care, with three of them in critical condition.

Two teenagers were killed on the island Samos after being struck by a collapsing wall. At least 19 people were injured on the island, with two, including a 14-year-old, being airlifted to Athens and seven hospitalized on the island, health authorities said.

The small tsunami that hit the Turkish coast also affected Samos, with seawater flooding streets in the main harbour town of Vathi.

The earthquake, which the Istanbul-based Kandilli Institute said had a magnitude of 6.9, was centred in the Aegean northeast of Samos. AFAD said it measured 6.6. and hit at a depth of some 16 kilometres (10 miles).

It was felt across the eastern Greek islands and as far as Athens and in Bulgaria. In Turkey, it shook the regions of Aegean and Marmara, including Istanbul.

Turkey is crossed by fault lines and is prone to earthquakes. In 1999, two powerful quakes killed some 18,000 people in northwestern Turkey. Earthquakes are frequent in Greece as well.

Authorities warned residents in Izmir not to return to damaged buildings, saying they could collapse in strong aftershocks. Many people spent the night out in the streets, too frightened to return to their homes, even if they sustained no damage.

The country has suffered from lightly regulated and shoddy construction which can lead to serious damage and deaths from earthquakes. Referring to the structure where the teenager and her dog were rescued, architect Nihat Sen told Turkish broadcaster NTV: "All material used on the eight-story building was faulty. The ground was bad, the material was bad."

Turkey's president said the government would aid victims who lost their homes with temporary housing and rent, while starting construction of new buildings.

In a show of solidarity rare in recent months of tense bilateral relations, Greek and Turkish government officials issued mutual messages of solidarity, and the leaders of Greece and Turkey held a telephone conversation.

"I thank President Erdogan for his positive response to my call," the Greek Prime Minister Kyriakos Mitsotakis said on Saturday before travelling to Samos, where he visited the families of the teenagers who were killed.

Relations between Turkey and Greece have been particularly tense, with warships from both facing off in the eastern Mediterranean in a dispute over maritime boundaries and energy exploration rights. The ongoing tension has led to fears of open conflict between the two neighbours and nominal NATO allies.

The quake occurred as Turkey was already struggling with an economic downturn and the coronavirus pandemic. So far, more than 10,000 people with the virus have died in Turkey. The health minister said authorities were distributing masks and disinfectant to protect against COVID-19.