Russia also raced to reinforce its troops in Syria by sea and air before the Putin-Erdogan talks
Turkey and Russia agreed a ceasefire deal on Thursday in Syria's Idlib region, their two leaders said after talks in Moscow to contain a conflict which has displaced nearly a million people in three months.
Russian President Vladimir Putin, standing next to his Turkish counterpart Tayyip Erdogan, said he hoped their agreement would lead to a halt of military action in Syria's last major rebel stronghold in the northwest of the country.
"I express hope that these agreements will serve as a good basis for a cessation of military activity in the Idlib de-escalation zone (and) stop the suffering of the peaceful population and the growing humanitarian crisis," Putin said.
Erdogan told reporters the truce would come into effect at midnight on Thursday. "We will work together to supply aid for the Syrians in need," he said, adding that Turkey retained the right "to respond to all (Syrian) regime attacks in the field."
Russia and Turkey back opposing sides in Syria's nine-year conflict, with Moscow supporting President Bashar al-Assad and Turkey backing some rebel groups. Several previous deals to end the fighting in Idlib have collapsed.
The latest offensive in Idlib by Assad's forces, backed by Russian air strikes, sparked what the United Nations says may be the worst humanitarian crisis yet in a war that has driven millions from their homes and killed hundreds of thousands.
The Russian military has, however, repeatedly played down any talk of a refugee crisis and accused Turkey of violating international law by pouring enough troops into Idlib to make up a mechanised division.
Turkey, which has the second largest army in the transatlantic NATO alliance, has funneled troops and equipment into the region in recent weeks to resist the Syrian government advance and prevent a wave of refugees over its southern border.
Russia also raced to reinforce its troops in Syria by sea and air before the Putin-Erdogan talks.
Assad himself has vowed to recapture "every inch" of Syrian territory, but his depleted military depends heavily on Moscow's power and Iranian-backed militias on the ground. Iran was not a party to Thursday's deal.
Apart from Idlib, a large stretch of northern Syria remains outside Assad's control, held by Turkey and its rebel partners, and by US-backed Kurdish forces.
The Kremlin said the two leaders had spoken for three hours on their own before being joined by their officials.
They agreed to establish a secure corridor near the M4 highway, which runs east to west through Idlib, and hold joint patrols along the road from March 15.
In a joint statement, they said the corridor would stretch 6 km to the north and 6 km to the south of the M4 - effectively advancing Russia's presence further north into Idlib.
The Russian and Turkish defense ministers would agree on the parameters of the corridor within seven days.
The deal did not spell out - as Erdogan has repeatedly demanded - that Syrian forces withdraw to the edge of the Idlib "de-escalation zone", around which Turkey has stationed a dozen military observation posts, most of them now surrounded by Russian-backed Syrian government forces.
The fighting, which raised the prospect of a direct clash between Russia and Turkey, has killed around 60 Turkish troops in the region since last month. Two hours after the joint announcement Turkey's defense ministry said two soldiers were killed after Syrian government forces opened fire in Idlib.
Putin expressed his regret to Erdogan about the recent killing of 34 Turkish troops in an air strike, saying the Syrian military had not known of their location.
Ahead of the talks, at least 16 civilians were killed when Russian air strikes hit a gathering of displaced people near the town of Maarat Misrin in Idlib, according to civil defense workers helping clear the rubble and search for survivors.
Russia denies targeting civilians.
Turkey hosts some 3.6 million Syrian refugees and says it cannot handle more. Seeking to extract more funding and support from Europe over Idlib, Ankara said last week it would no longer abide by a 2016 deal in which it stopped migrants crossing into the European Union in return for billions of euros in aid.