The agreement, hailed by Syria's government as a 'real opportunity' to find a political solution to the war, comes a week after the regime recaptured second city Aleppo in a major blow to rebel forces.
Syria's army and key ally Russia on Thursday announced a nationwide ceasefire to take effect at midnight, in a potential major breakthrough after nearly six years of civil war.
The deal was brokered by Russia and Turkey, which back opposing sides in the conflict, but does not involve Washington, which has negotiated previous ceasefires with Moscow.
The agreement, hailed by Syria's government as a "real opportunity" to find a political solution to the war, comes a week after the regime recaptured second city Aleppo in a major blow to rebel forces.
Russian President Vladimir Putin, who announced the deal, said Damascus and the "main forces of the armed opposition" had inked a truce and a document expressing a readiness to start peace talks.
"Several hours ago, the event occurred that we have not only been waiting for but been working so much to hasten," Putin said in a meeting with his defence and foreign ministers.
Turkish President Recep Tayyip Erdogan described the agreement as a "historic opportunity" to end the Syrian conflict, which has killed more than 310,000 people and forced millions from their homes.
Syria's army said it would halt all military operations from midnight (2200 GMT on Thursday) and a leading opposition body, the National Coalition, voiced its support for the truce.
Putin said he would also reduce Moscow's military contingent in Syria that has been flying a bombing campaign in support of President Bashar al-Assad since last year.
The Kremlin strongman, however, said Russia would continue to fight "terrorism" in Syria and maintain its support for the regime.
Russian Defence Minister Sergei Shoigu said seven opposition groups, including the powerful Ahrar al-Sham, had signed the deal and those who failed to adhere would be considered "terrorists".
Erdogan indicated Turkey would press on with its four-month incursion into Syria against Islamic State group (IS) jihadists and Kurdish militia.
Astana peace talks
Syria's army said the deal did not include IS and the former Al-Qaeda affiliate Al-Nusra Front, now rebranded the Fateh al-Sham Front.
That could cause complications in areas like Idlib in northwestern Syria, where Fateh al-Sham is allied with rebel groups that have signed on to the deal.
Syria's political opposition and rebels confirmed their backing for the truce, saying it applied to all parts of the country.
"The agreement is for all of Syria and contains no exceptions or preconditions," said Osama Abou Zeid, a legal adviser to rebel groups fighting under the Free Syrian Army banner.
The agreement comes after Turkey and Russia brokered a deal to allow the evacuation of tens of thousands of civilians and rebel fighters from Aleppo.
Moscow and Ankara are now pushing for peace talks between Damascus and the rebels to start soon in Kazakhstan's capital Astana.
"Now we need to do everything for these agreements to come into force, for them to work, so that the negotiating teams that have been or are being formed promptly and as soon as possible arrive in Astana," Putin said.
UN peace envoy Staffan de Mistura said he hoped the agreement would "pave the way for productive talks" in Kazakhstan, but also reiterated he wants negotiations mediated by his office to continue early next year.
22 killed in rebel areas
Russia and Turkey have both said the peace talks they will supervise are meant to supplement UN-backed peace efforts, rather than replace them entirely.
Russian Foreign Minister Sergei Lavrov said that Russia, Turkey and Iran were arranging for the talks and pressing for other key international players to get involved.
Lavrov said Moscow would invite Egypt and try to attract other regional powers such as Saudi Arabia, Qatar, Iraq and Jordan.
He added Moscow would seek to involve US President-elect Donald Trump's administration once he takes office in less than a month, but the process does not appear to involve outgoing President Barack Obama's administration.
The US State Department called the ceasefire deal a "positive development" and said it hoped it would lead to fresh negotiations on Syria's political future.
Abou Zeid confirmed the truce deal was intended to pave the way for new talks in Astana, with the High Negotiations Committee that has represented the opposition at previous negotiations expected to participate.
Turkey has long backed Syria's opposition, and its relations with Russia soured last year after Ankara shot down a Russian warplane.
But the two countries have worked closely of late on Syria, and Turkey was conspicuously quiet as Assad's forces retook Aleppo.
In the hours before the ceasefire was to take effect, the Syrian Observatory for Human Rights, a Britain-based monitoring group, reported at least 22 civilians, including 10 children, were killed in air strikes and artillery fire on rebel-held territory near Damascus.