Erdogan hosted General Mohammad Hossein Bagheri at his presidential palace in Ankara with Turkey's top general Hulusi Akar also in attendance, the Turkish presidency said.
The state-run Anadolu news agency said the hugely unusual talks lasted 50 minutes, but gave no details.
Reports ahead of Bagheri's three day visit, which began yesterday, had said the Iranian general was aiming to coordinate policy on Syria and Iraq.
Relations between overwhelmingly Sunni Muslim Turkey, a secular state, and the mainly Shiite Islamic Republic of Iran have on occasion been tense in the last years.
Also Read
Erdogan has sometimes lashed out at the rise of "Persian nationalism" in the region, especially concerning the power of Shiite militias in Iraq.
But Turkey and Russia have been cooperating more over Syria in recent months, helping to extract civilians from Aleppo and then co-sponsoring peace talks in the Kazakh capital Astana.
Tehran may also share Ankara's concerns about over sway of the Syrian Kurdish People's Protection Units (YPG) in the border area.
The rise of jihadists in the province of Idlib, neighbouring Turkey, has also alarmed Ankara, Moscow and Tehran.
A senior official from Iran's elite Revolutionary Guards earlier said Bagheri's trip was prompted by the presence of "terrorist groups" in the border area, without saying which ones.
"We are seeking a good agreement with Turkey to provide better security for Iranian and Turkish borders especially in the west and northwest," said Guards spokesman General Ramezan Sharif, quoted by the IRNA news agency.
Disclaimer: No Business Standard Journalist was involved in creation of this content