President Salva Kiir and rebel leader Riek Machar signed the deal in neighbouring Sudan.
The deal, which will see Mr Machar return to power as one of five vice-presidents, is aimed at ending a five-year civil war which has killed tens of thousands and displaced millions.
Previous attempts to find a peaceful solution have failed.
â€œIn initials, an agreement on outstanding issues has been signed and this agreement expresses the commitment of all parties to a ceasefire,â€ said Sudanese Foreign Minister Al-Dirdiri Mohamed, who helped to broker the deal.
Mr Kiir said on Friday he was more confident that the current deal would work because it had not been â€œforced on usâ€ unlike previously.
â€œThis agreement will not collapse and I am sure that it will not collapse because the people of South Sudan have now agreed that they must make peace among themselves,â€ he said, quoted by Reuters.
South Sudan became independent in 2011. It has been wracked by civil war, which has seen ethnic cleansing and numerous atrocities, since 2013.
The conflict has been fuelled by divisions between the Mr Kiirâ€™s Dinka and Mr Macharâ€™s Nuer ethnic groups.
It began when Mr Kiir fired his then deputy Mr Machar, accusing him of planning a coup â€“ an allegation he denied.