After lengthy talks, Russian President Vladimir Putin and Turkish counterpart Recep Tayyip Erdogan agreed on a 10-point memorandum on Syria that the Russian leader called "very important if not crucial" and Erdogan hailed as "historic".
It was released after the talks in Russia's Black Sea resort of Sochi on Tuesday.
Russia and Turkey agreed to ensure Kurdish forces withdraw from areas close to Syria's border with Turkey and to launch joint patrols.
Turkey has seized control of a "safe zone" inside Syria about 120 kilometres long and 32 kilometres deep and the agreement keeps this as the "status quo".
KURDISH FORCES REMOVAL
The deal will see Turkey preserve the zone between the border towns of Tal Abyad and Ras al-Ain.
From noon (0900 GMT) on Wednesday, Russian military police and Syrian border guards were to "facilitate the removal" of Kurdish People's Protection Units (YPG) fighters and their weapons from within 30 kilometres of the Turkish-Syrian border.
Ankara says the YPG is a "terrorist offshoot" of the outlawed Kurdistan Workers' Party (PKK), which has been waging an insurgency inside Turkey since 1984.
This withdrawal must be finalised within 150 hours.
The Russian and Turkish patrols will then start in two zones stretching 10 kilometres to the east and west of the area captured by Turkey's offensive, called Operation Peace Spring.
This will allow Turkey to patrol with Russia in areas inside Syria that were not part of its offensive.
NO TRACE OF YPG
The agreement says all YPG militia "elements and their weapons" will be removed from the strategic cities of Manbij and Tal Rifaat in northern Syria.
"All YPG terrorists in Tal Rifaat and Manbij will be removed outside this region, together with their weaponry," Erdogan said.
Tal Rifaat is a town in Aleppo province that lies 20 kilometres south of the frontier. It has changed hands several times. The Syrian Democratic Forces (SDF), dominated by the YPG, captured it from Syrian rebels in 2016, despite Turkey's efforts to keep them back.
Turkey last year threatened to launch a cross-border offensive to capture Tal Rifaat, but Russia made assurances that the YPG militia was no longer there.
In March Turkey and Russia began holding patrols in Tal Rifaat.
Last week Syrian forces took control of the key town of Manbij, about 30 kilometres from the Turkish border after US troops withdrew from their base there.
The SDF aided by US forces took control of the city in 2016, ousting the IS group. Turkey was enraged, fearing a powerful Kurdish presence on its southern border.
RETURN OF REFUGEES
The memorandum says Russia and Turkey will launch joint efforts to "facilitate the return of refugees in a safe and voluntary manner". There are 3.6 million Syrian refugees in Turkey.
The agreement says the countries back the process of peace talks launched by Turkey together with Russia and Iran to find a "lasting political solution" to the conflict.
The peace process is named after the Kazakh capital of Astana where discussions have been held since 2017, although the city has since been renamed Nur-Sultan.