The 7.0 magnitude tremor was centred off Turkey's Izmir province, the US Geological Survey (USGS) said.
Turkey put the magnitude lower, at 6.6, saying 20 people had died and 786 were injured in the province of Izmir. On Samos, two teenagers were killed.
The shallow tremor triggered a mini-tsunami that flooded Izmir and Samos.
The authorities in Izmir, the provincial capital, are now setting up a tent area to house about 2,000 people overnight, amid fears that more buildings could collapse.
The authorities said that 70 people had been rescued from under the rubble.
Rescuers continued to dig through concrete blocks after darkness fell, hoping to find more survivors.
The USGS said the quake - which was felt as far away as Athens and Istanbul - struck at a depth of 10km (six miles)
Image captionRescuers and local residents are frantically searching for survivors in Izmi
Image captionThe death toll could rise further as a number of people are feared trapped under the rubble in Izmir
In Izmir, Turkey's third largest city with the population of nearly three million, many people were seen running out into the streets in panic and fear after the quake struck. At least 20 buildings collapsed.
Videos have been posted on social media appearing to show the moment one multi-storey building went down, the BBC's Orla Guerin in Istanbul reports. Other footage shows local people scrambling over rubble looking for survivors.
There were reports of flooding in the city after the sea level rose, and some fishermen are said to be missing.
"It was a really strong shaker almost enough to knock you off your feet. Running out of the house with my children was like a drunken wobble," Chris Bedford, a retired British teacher who lives in Urla, west of Izmir.
Yasar Keles, an official in Sigacik, near Izmir, told BBC Turkish that a person died after their wheelchair was hit and overturned by the rising water.
Officials later said that 70 people had been rescued from under the rubble.
Turkish President Recep Tayyip Erdogan said the government would help those affected by the quake "with all the means available to our state".
Image captionOn Samos, residents were urged to stay outdoors as aftershocks continued
In Greece, two teenagers were killed when a wall collapsed on Samos.
A mini-tsunami flooded the port of Samos and a number of buildings were damaged. Greek officials put the magnitude of the tremor at 6.7.
"We felt it very strongly," local journalist Manos Stefanakis told the BBC, adding that smaller aftershocks were continuing.
He said it was the biggest tremor to have hit the island since 1904.
Fareid Atta, another Samos-based journalist, told the BBC that the damage was "quite extensive along the seafront" of the island's main town.
"Many businesses will be going under after this," he said.
Residents were urged to stay outdoors and keep away from coastal areas. About 45,000 people live on Samos.
I was in the kitchen. The washing machine was going and I thought it was just doing that thing when it shakes and moves around at first. But the fridge was moving.
I ran out. Women were running everywhere. For a lot of the women it's quite traumatic as they've come from places like Syria and it could have felt like they were being bombed or something.
At some point everybody started to run. People were panicking. Our house is not safe to stay in as there are a lot of cracks.
Greek Prime Minister Kyriakos Mitsotakis said he called Mr Erdogan "to offer my condolences for the tragic loss of life from the earthquake that struck both our countries".
" Whatever our differences, these are times when our people need to stand together ," Mr Mitsotakis wrote in a tweet.
Mr Erdogan later responded, also by posting a tweet.
" I offer my condolences to all of Greece on behalf of myself and the Turkish people ," he wrote.
"Turkey, too, is always ready to help Greece heal its wounds. That two neighbours show solidarity in difficult times is more valuable than many things in life," he added.
A powerful quake that struck the Turkish city of Izmit, near Istanbul, in 1999 killed about 17,000 people.
তুর্কি ভূমিকম্প ২০২০ সালের অক্টোবর, তুর্কি ইজমিরে বহু মানুষ হতাহত হয়েছে, বিল্ডিং ধসে পড়েছে, তুর্কি ভূমিকম্প ২০২০ সিসিটিভিতে, মানুষের কান্নায় চারিদিকে শোক নেমে এসেছে।
![](https://s2.save4k.ru/pic/XITsb4QPImg/maxresdefault.jpg)