Turkish President Recep Tayyip Erdogan has flown in to Istanbul, after an army group said it took over the country.
He was seen surrounded by supporters, and said the coup attempt was an “act of treason” in a live TV speech.
The army group earlier declared that a “peace council” now ran the country and there was a curfew and martial law.
But Prime Minister Binali Yildirim later said the situation was largely under control and a no-fly zone was in force over the capital Ankara.
Government officials in Turkey say dozens of people have been arrested, but the whereabouts of the military chief of staff remains unknown.
Soldiers were earlier seen at strategic points in Istanbul, with jets flying low in Ankara.
Two large explosion were also heard near Istanbul’s central Taksim Square.
There were also reports of blasts at parliament building in Ankara. MPs were believed to be hiding in shelters.
It is unclear who is leading the plotting army group, or how much support it enjoys. Some top army officials are said to be detained.
People across Turkey are very confused and surprised, the BBC’s Katy Watson in Istanbul says.
In Washington, US President Barack Obama urged all parties in Turkey to support the “democratically elected government”.
Nato called for “full respect” for Turkey’s democratic institutions.
Speaking in Istanbul in the early hours on Saturday, President Erdogan promised to clean up the army.
“Those who drive around in tanks will have to go back to where they came from,” he said.
He also dismissed the coup leaders as “terrorists”.
Mr Erdogan earlier told CNN Turk by mobile phone the action was by a “parallel structure” that would bring the necessary response. He has used this term in the past to refer to Fethullah Gulen, a US-based Muslim cleric he accuses of fomenting unrest.