Armenian Prime Minister Nikol Pashinyan says he has signed a deal with the leaders of Azerbaijan and Russia to end the military conflict over the Nagorno-Karabakh region.
The declaration, set to come into effect from 8am AEDT Wednesday, follows six weeks of heavy fighting.
Baku said on Monday it had seized dozens more settlements in Nagorno-Karabakh, a day after proclaiming victory in the battle for the enclave's second-largest city.
"The decision is made basing on the deep analyses of the combat situation and in discussion with best experts of the field," Mr Pashinyan said on social media.
"This is not a victory but there is not defeat until you consider yourself defeated. We will never consider ourselves defeated and this shall become a new start of an era of our national unity and rebirth."
Russian President Vladimir Putin confirmed the agreement of a "total ceasefire" in a separate statement shortly after.
Mr Putin said Russian peacekeepers would be deployed along the frontline in Nagorno-Karabakh and the corridor between the region and Armenia.
Azerbaijani President Ilham Aliyev said the ceasefire amounted to a "capitulation" by Armenia.
"We forced him to sign this document," Mr Aliyev said of Mr Pashinyan in televised remarks. "This is essentially a capitulation."
Armenian protesters angered by the agreement reportedly stormed the government headquarters in Yerevan.
Several thousand protesters gathered outside the government building and a few hundred entered, ransacking offices and breaking windows, AFP reported.
Nagorno-Karabakh is internationally recognised as part of Azerbaijan, but populated by ethnic Armenians.
Several thousand people are feared killed in the flare-up of the conflict. Three ceasefires have failed in the past six weeks and Azerbaijan’s superior weaponry and battlefield gains have reduced its incentive to seek a lasting peace deal.
Additional reporting by AFP.