NAIROBI, Kenya — The government of South Sudan and rebels loyal to the country’s ousted former vice president signed a cease-fire agreement Thursday, holding out the prospect of peace after more than a month of fighting that has torn the new nation apart.

Under the agreement, signed in the Ethiopian capital, Addis Ababa, both sides in the conflict promised to lay down their weapons for five weeks. But they have also said that a cessation of hostilities would be a temporary measure, short of a formal peace agreement, and that negotiations would have to continue.

The deal represents the first real progress since political friction turned violent Dec. 15, fueling countrywide battles with ethnic overtones.

While humanitarian groups welcomed the cease-fire as an opportunity to restore peace and stability, political analysts said a cease-fire was only the first step in bringing an end to a civil war that has killed thousands and displaced more than 500,000 South Sudanese.

Unlimited Digital Access. $1 for 4 weeks.

Refugees, many of them unaccompanied children, have streamed across the border by the tens of thousands into Uganda, Sudan, Ethiopia and Kenya. More than 70,000 people are sheltering at U.N. bases in South Sudan, afraid they will be killed either by crossfire or in targeted attacks.

Neighboring countries and global powers, including the United States, China and the United Nations, placed significant pressure on the parties to reach an agreement, fearing that the fighting could escalate into a protracted civil war or a wider regional conflict.

The South Sudanese government of President Salva Kiir and the rebels had difficulty finding common ground, in particular on the question of the release of prisoners who support the former vice president, Riek Machar. But the Intergovernmental Authority on Development, which has mediated the negotiations, said an agreement was signed late Thursday.

Talks are scheduled to resume in February.