The government and rebels in South Sudan have agreed to end fighting and form a transitional government within 60 days, Ethiopia says.
The regional Igad bloc, mediating the conflict, has threatened sanctions if they fail to abide by the agreement.
It follows a rare meeting between President Salva Kiir and rebel chief Riek Machar in Addis Ababa, Ethiopia.
Previous deals to end the violence have been broken by both sides, compounding the worsening humanitarian crisis.
The BBC outlines the background to South Sudan's crisis - in 60 seconds.
Thousands have now died in the conflict that started as a political dispute between Mr Kiir and Mr Machar, his sacked deputy, but escalated into ethnic violence.
More than a million people have fled their homes since fighting erupted last December.
Ethiopian Prime Minister Hailemariam Desalegn announced the new agreement on Tuesday, after President Kiir and Mr Machar met on the sidelines of an Igad summit on Tuesday,
"If they don't abide to this agreement, Igad as an organisation will act to implement peace in South Sudan. On that, we have different options including sanctions and [other] punitive actions as well," he said.
"There has been a growing tendency to continue with the war," he added, criticising both sides for breaking a previous ceasefire agreed on 9 May.
It is the first time South Sudan's neighbours have issued such a warning, reflecting a growing frustrating with the South Sudanese leaders, correspondents say.
Both sides blamed each other for breaking a ceasefire agreed on 9 May
The UN says millions are facing starvation with many people unable to farm and little access to food
The US has already imposed sanctions on both sides of the conflict, singling out commanders loyal to both President Kiir and Mr Machar.
The violence began in December when Mr Kiir accused his sacked deputy of plotting a coup.
Mr Machar denied the allegation, but then marshalled a rebel army to fight the government.
The battle assumed ethnic overtones, with Mr Machar relying heavily on fighters from his Nuer ethnic group and Mr Kiir from his Dinka community.
Nearly four million people in South Sudan, which seceded from Sudan in 2011, are now at risk of serious food insecurity, according to the UN.
South Sudan is the world's newest state, becoming independent in 2011 after seceding from Sudan.
Fighting erupted in the South Sudan capital, Juba, in mid-December. It followed a political power struggle between President Salva Kiir and his ex-deputy Riek Machar. The squabble has taken on an ethnic dimension as politicians' political bases are often ethnic.
Sudan's arid north is mainly home to Arabic-speaking Muslims. But in South Sudan there is no dominant culture. The Dinkas and the Nuers are the largest of more than 200 ethnic groups, each with its own languages and traditional beliefs, alongside Christianity and Islam.
Both Sudan and the South are reliant on oil revenue, which accounts for 98% of South Sudan's budget. They have fiercely disagreed over how to divide the oil wealth of the former united state - at one time production was shutdown for more than a year. Some 75% of the oil lies in the South but all the pipelines run north.
The two Sudans are very different geographically. The great divide is visible even from space, as this Nasa satellite image shows. The northern states are a blanket of desert, broken only by the fertile Nile corridor. South Sudan is covered by green swathes of grassland, swamps and tropical forest.
After gaining independence in 2011, South Sudan is the world's newest country - and one of its poorest. Figures from 2010 show some 69% of households now have access to clean water - up from 48% in 2006. However, just 2% of households have water on the premises.
Just 29% of children attend primary school in South Sudan - however, this is also an improvement on the 16% recorded in 2006. About 32% of primary-age boys attend, while just 25% of girls do. Overall, 64% of children who begin primary school reach the last grade.
Almost 28% of children under the age of five in South Sudan are moderately or severely underweight. This compares with the 33% recorded in 2006. Unity state has the highest proportion of children suffering malnourishment (46%), while Central Equatoria has the lowest (17%).
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.