Leaders say there will be no attack on the rebel city.
Turkey and Russia decided to form a demilitarized zone between rebels and government forces in Syria’s Idlib region, President Tayyip Erdogan said on Monday.
Russian President Vladimir Putin said it would be 15-km to 25-km wide and come into force by 15 October.
Troops from Russia, an ally of Syria's government, and Turkey, which backs the rebels, will patrol the zone.
Speaking at a news conference alongside Russian President Vladimir Putin in the Russian city of Sochi, Erdogan said the two nations will carry out coordinated military patrols on the borders of the demilitarized zone.
The UN had warned of a humanitarian catastrophe if the Syrian army launched an all-out assault to retake Idlib.
Putin said that under the deal, all heavy weaponry, including tanks, rocket launch systems and mortar launchers operated by rebel groups would need to be pulled out of the buffer zone by 10 October.
Jihadist groups, including those of al-Nusra Front, Putin said, would have to leave the zone.
It was not immediately clear if the zone included Idlib city, which would require some rebels to withdraw from it.
Erdogan said: "We will prevent a humanitarian tragedy which could happen as a result of military action."
He had earlier called for a ceasefire in northern Syria to prevent what he said would be a "bloodbath" and another major refugee crisis on Turkey's southern border.