(CNN) -- A broad agreement that includes restarting oil exports was signed Thursday by Sudan's President Omar Al Bashir and South Sudan's President Salva Kiir during a ceremony in Addis Ababa.
The two presidents also reached a deal on a demilitarized zone and principles of border demarcation -- although key issues around the contested region of Abyei and other border disputes remain to be resolved.
The signing ceremony, broadcast live on Sudanese state TV Thursday afternoon, followed several days of talks in Addis Ababa, Ethiopia.
The summit between Kiir and Al Bashir, which began Sunday, was supposed to last just one day to meet a deadline set by the African Union and U.N. Security Council.
Kiir said the agreement marked a great day for the two nations but called for a swift resolution to the question of Abyei's future, for the sake of its people.
Al Bashir also welcomed the deal, saying it reflected a "desire to achieve peace and stability and the mutual benefit" of the two nations.
The status of Abyei, claimed by both Sudan and South Sudan, has been a matter of contention since the South declared independence on July 9 of last year.
The economic deal that includes revenue sharing between the two nations of South Sudan's oil wealth is desperately needed by both economies.
In January, South Sudan shut off its oil supply -- which is shipped and exported through Sudan's infrastructure -- saying that Sudan was stealing oil revenue. The South got around 70% of the formerly united country's reserves when it became independent last year.
Both countries, especially South Sudan, have seen hyperinflation and a squeeze on incoming foreign currency, which has hurt their economies.
Under the agreement, the demilitarized zone along the border will mean the militaries of Sudan and South Sudan and other armed groups will not be allowed in a prescribed zone on either side of the border, creating a buffer between the forces.
However, the status of disputed areas along the border and the fate of Abyei are crucial security issues that will need to be addressed if the two recently divorced countries are to have lasting peace.
In April, Sudan and South Sudan slipped close to all-out war with a series of tit-for-tat air raids and ground attacks that prompted the African Union and Security Council to push the two sides to act.
The Security Council had given the sides until Sunday to come up with a deal or face sanctions, but the negotiators said that had been informally extended until the end of the talks.
South Sudan's spokesman Atif Kiir said late Wednesday that more talks were planned.
"For the border issues we had agreed that we are going to continue our talks and we are hopeful to reach an agreement for the peace and security of the two countries, for the peace of the two regions and for the international community," said Kiir.
Under a 2005 peace agreement that ended Sudan's two-decade civil war, Abyei residents were to take part in a referendum on whether to join the South or remain a special administrative region within Sudan.
The vote was to take place in January 2011, at the same time as the referendum that led to South Sudan's secession. But disputes over who was eligible to vote prevented the referendum from going forward in Abyei.
Sudan and South Sudan have been under increasing pressure from the African Union and Security Council to resolve the matter peacefully.