Iranian President Hassan Rouhani and Turkey's President Tayyip Erdogan agreed on Wednesday to improve ties, including in the fight against terrorism, Iran's state news agency IRNA said, following some angry exchanges between the regional rivals.
Tehran and Ankara support opposite sides in the conflict in Syria. Largely Shia Muslim Iran backs the government of President Bashar al-Assad, while Turkey, which is majority Sunni, has backed elements of the Syrian opposition.
Last month Erdogan and Turkish Foreign Minister Mevlut Cavusoglu both accused Iran of trying to destabilise Syria and Iraq and of sectarianism, prompting Tehran to summon Ankara's ambassador.
Erdogan and Rouhani met on the sideline of an economic cooperation summit in the Pakistani capital Islamabad, IRNA said, though it gave no details of their talks.
Regional rivalry between Iran and Turkey is nothing new, but political analysts have linked Ankara's tougher rhetoric to U.S. President Donald Trump's approach to the Middle East.
Trump has been sharply critical of Iran, including a nuclear deal it clinched in 2015 with major powers, while Turkey, a NATO ally, is hoping for improved ties with Washington after a chill caused partly by U.S. criticism of Ankara's human rights record.
In another conciliatory move by Turkey, Cavusoglu told IRNA in an interview published on Wednesday that Ankara had appreciated Tehran's expressions of support for the government during a failed military coup against Erdogan on July 15, 2016.
"Iran was with us to support our government in every minute at that night while some other countries only called us days or even weeks after the attempted coup," IRNA quoted him as saying.
Last week Iranian Foreign Minister Mohammad Javad Zarif had called Turkey an ungrateful neighbour.
"They (Turkey) accuse us of sectarianism but don't remember we didn't sleep on the night of the coup," he said.