Prime Minister Ahmet Davutoglu, who also met Barzani, defended the deployment of several hundred troops -- which has enraged Baghdad -- as a necessary measure to help Iraq in the fight against Islamic State jihadists.
With tensions soaring, Turkey urged its citizens to leave all areas of Iraq excluding Iraqi Kurdistan, due to increased security risks.
According to Turkish presidential sources, Erdogan told Barzani of Turkey's determination to fight all terror groups, including IS and the outlawed Kurdistan Workers Party (PKK) which has bases in northern Iraq.
"Erdogan and Barzani stressed that cooperation in the fight against terrorism is important to stability in the region," the sources added.
No official comment was made after the almost one-and-half hour meeting in Ankara.
Barzani earlier made an unannounced visit to Turkey's National Intelligence Organisation (MIT) and held talks with spy chief Hakan Fidan, local media reported.
Barzani has long-standing ties with Ankara, and there are multiple Turkish military sites in Iraq's autonomous Kurdish region.
But there have been growing strains between Ankara and the central Baghdad government over Turkey's deployment of up to 300 soldiers in Bashiqa close to an area held by IS in northern Iraq.
Turkey has described the deployment as a routine rotation to train local Iraqi forces to retake the city of Mosul from IS jihadists.
The Iraqi federal government has told Turkey to withdraw its troops, saying they had entered the country illegally without its consent.
- 'Act of solidarity' -
Davutoglu insisted the troops were there to train local Iraqis to fight against IS jihadists as well as to protect Turkey's own military trainers.
"No-one can say that this (troop deployment) is a surprise," Davutoglu told foreign reporters in Istanbul before meeting Barzani in Ankara.
Signup to our newsletter and follow us on Facebook and Twitter!
"When the threats increased (to the lightly-armed Turkish trainers), we sent troops to protect the camp. It's not an act of aggression but an act of solidarity."
He said the troop transfer had been halted in the light of Baghdad's angry reaction but insisted those already deployed would stay.
"When we saw the reaction (of the Iraqi government) we stopped the transfer."
Davutoglu is expected to visit Baghdad soon with the aim of calming tensions.
Baghdad on Sunday gave Turkey a 48-hour deadline and threatened to appeal to the UN Security Council unless the troops are withdrawn.
Turkey said it had halted further deployment to the Bashiqa area but said there would be no pull-out.
"Our presence (near) Mosul will continue as part of the training programme," Erdogan's spokesman Ibrahim Kalin told reporters in Ankara.
Kalin said the issue could be resolved through dialogue with Iraq.
"The main issue is to support Iraqis in their fight against Daesh," he said, using an Arabic acronym for IS.
"It has nothing to do with violation of a country's sovereignty rights."
Authorities say the Turkish army has trained local Iraqis in the Bashiqa area since March, indicating the troops have not been given any combat mission.
Writing on Twitter this week, Brett McGurk, the special US envoy for the anti-IS coalition, said Washington does not support military deployments inside Iraq "absent the consent of the Iraqi government."
"This includes deployment of US military personnel, as well as military personnel from any other country," he wrote.
In its travel warning, Ankara cited increasing threats targeting Turkish companies recently, as well as declarations encouraging violence, abduction and attacks.