Iranian Foreign Minister Mohammad Javad Zarif on Wednesday held previously unannounced talks with President Recep Tayyip Erdogan, the Turkish presidency said, with the situation in Syria likely to have dominated the agenda.
With expectation growing of an offensive by Tehran ally President Bashar al-Assad in Syria's Idlib province bordering Turkey, Zarif held one hour of talks with Erdogan at his ruling party headquarters in Ankara Turkish Foreign Minister Mevlut Cavusoglu, who attended the meeting, said "bilateral ties... (and) Syria" were on the agenda, state-run Anadolu news agency reported.
Zarif, who heads now to Pakistan, posted on Twitter after the meeting that the talks had been "fruitful".
He said they focused "on bilateral relations and regional cooperation in the face of malign US behaviour".
Iran has strongly supported Turkey as it was hit by sanctions from Tehran's arch enemy the United States which have caused the Turkish lira to nosedive in value.
Turkey has been keeping a wary eye on the possibility of the Idlib offensive, as it seeks to bring peace to Syria along with Iran and Assad's other main ally Russia.
Ankara has throughout the seven-year civil war in Syria supported rebels seeking to oust Assad but has put differences aside to form a three-way alliance with Tehran and Moscow.
Erdogan and his counterparts Hassan Rouhani of Iran and Russia's Vladimir Putin are due to meet in Iran for a third summit on Syria on September 7, Turkish reports have said.
But analysts say that Idlib, which is largely controlled by rebel groups, could test the alliance with Turkey, as Ankara warns a military solution could lead to catastrophe and a new influx of refugees across its borders.
Turkey has 12 military observation posts inside Idlib aimed at monitoring a de-escalation zone and media reports have said it has sent concrete blocks over the border to reinforce them in case of an assault.
But analysts also say Turkey is keen to preserve the three-way alliance and may be prepared to support a more limited offensive against the most extreme factions in Idlib.
Russian Foreign Minister Sergei Lavrov on Wednesday called on the West not to stand in the way of an "anti-terror operation" in Idlib.
Lavrov also said there is "full political understanding" between Russia and Turkey adding it was necessary to "disassociate the so-called moderate opposition from terrorists."