Turkey's foreign minister says he has paid a surprise visit to Iran just days after the two countries agreed to greater cooperation on Syria despite their differences.

Foreign Minister Mevlut Cavusoglu told Turkish state media on Friday that he stopped in Tehran on his way to India on Thursday.

The Turkish and Iranian foreign ministers met in Ankara last week and said they would cooperate more on finding a lasting solution to the crisis in Syria.

Turkey and Iran have held opposing positions on Syria, with Iran backing the government of Syrian President Bashar Assad and Turkey advocating for Assad's departure.

State-run Anadolu Agency quoted Cavusoglu as saying: "We have to increase our efforts. The (Syria) problem grows deeper and more insolvable with time."