Turkey and Russia have agreed a ceasefire from midnight local time in Syria's north-western Idlib province in a bid to avoid a major escalation.
In Moscow, Russian President Vladimir Putin and his Turkish counterpart Recep Tayyip Erdogan also agreed to establish a security corridor and joint patrols.
Last month, 36 Turkish soldiers were killed in Idlib during a Russian-backed Syrian government offensive.
Turkey, which backs opposition rebels, responded by attacking Syrian troops.
The incident sparked fears of a direct military conflict between Turkey and Russia.
What about the ceasefire deal?
The agreement was announced after about six hours of talks between Mr Putin and Mr Erdogan in the Russian capital.
The two sides said the deal included:
- A ceasefire from 00:01 local time on Friday (22:01 GMT Thursday) on the whole line of contact
- A security corridor 6km (four miles) north and 6km south from Idlib's key M4 motorway, which connects the government-held cities of Aleppo and Latakia
- Joint Russian-Turkish patrols along the M4 from 15 March
Despite the agreed ceasefire, Turkey "reserves the right to retaliate with all its strength against any attack" by forces of Syrian President Bashar al-Assad, Mr Erdogan warned.
In September 2018, Mr Putin and Mr Erdogan agreed to turn Idlib into a "de-escalation zone." The area was intended to act as buffer between the two sides, with clear lines of control, but fighting has continued in the zone.
President Putin said he hoped the deal "will serve as a good foundation for ending the fighting in the Idlib de-escalation zone and end the suffering of the civilian population".
The BBC's diplomatic correspondent Jonathan Marcus says fundamental questions remain about this latest ceasefire, including how long the truce will last, whether Syrian government forces or Turkish troops will pull back to designated zones, and what will be the fate of the huge number of refugees.
In short, our correspondent says it is unclear whether the Assad regime and its Russian backers have given up on the idea of seizing back all of Idlib, and whether this is a permanent policy shift or just a temporary expedient to reduce the current tensions with Ankara.
In 2018, Russia and Turkey agreed a ceasefire and de-escalation zones in Idlib - but that deal has often been violated.
Idlib is the last rebel-held province in Syria.
Russia and Turkey have diametrically opposed objectives in Syria. A confrontation was bound to happen. It will remain a built-in risk if their strategies stay the same.
Russia intervened when the Assad regime was fighting for survival and has provided the firepower to make possible the recapture of most of rebel-held Syria.
For President Putin, the Syrian war has been a vital part of re-establishing Russia as a power in the Middle East and beyond.
Turkey has been the most consistent backer of militias fighting the Assad regime.
President Erdogan sees Idlib province as a legitimate security interest and wants Turkey to be the strongest regional power.
Presidents Putin and Erdogan have proved that they can talk.
With Iran, they backed an attempted peace process in Syria. Russia sold Turkey a sophisticated air defence system. A ceasefire more or less held in Idlib until Syria, Russia and their allies went back on to the offensive during the winter.
But fighting close to the Turkish border, affecting interests that both sides consider vital, has resulted in a key member of Nato squaring up to Russia. That is a dangerous development.