Sudan has struck a deal with South Sudan over oil payments in a dispute that brought the two countries to the brink of war.
South Sudan has agreed to pay Sudan just over $9 (£5.7) per barrel to transport oil to its ports.
South Sudan stopped oil production in January over the dispute and Sudan will receive $3bn (£1.9bn) as compensation for revenue lost in that period.
However, the deal is subject to further talks on security.
The two sides also have outstanding border disputes.
The two countries have held three weeks of talks in the Ethiopian capital Addis Ababa.
The talks will resume towards the end of August with a summit between the presidents to follow to make the deal official, the African Union told the BBC.
Former South African president and African Union mediator Thabo Mbeki said all outstanding issues had been resolved.
"What will remain, given that there is an agreement, is to then discuss the next steps as to when the oil companies should be asked to prepare for resumption of production and export," Mr Mbeki said.
A Sudanese spokesman described the deal as "acceptable" even though it met neither side's full expectations.
US President Barack Obama welcomed the deal and said it "opens the door to a future of greater prosperity" for both countries.
When South Sudan seceded from the north in 2011, it took three-quarters of Sudan's oil with it.
The dispute over how much South Sudan should pay Khartoum to transport oil resulted in South Sudan suspending all oil production and accusing its neighbour of stealing its exports.
The dispute has severely affected the economies of both countries.
The two countries came close to all-out war in April, when South Sudanese troops briefly occupied the disputed oil-rich border area of Heglig.
The deal comes hours after US Secretary of State Hillary Clinton, on a visit to Juba, urged the two Sudans to strike a deal.
A United Nations deadline for the neighbouring countries to resolve their differences expired on Thursday.
South Sudan is working towards building a pipeline through Kenya, a move that would end the country's dependence on Sudan.