"The parties have agreed on all of the financial arrangements regarding oil," African Union mediator Thabo Mbeki said Saturday, two days after a United Nations deadline for the neighbours to resolve arguments over oil and borders expired.
Landlocked South Sudan said it had agreed to pay a pipeline transit fee of $9.48 per oil barrel to transport its crude through Sudan, a significant drop from Khartoum's initial demands of up to $36 a barrel in fees.
In addition, Juba agreed to make a "one-off payment" to Khartoum of some $3 billion to cover the massive financial gap created by the South's independence last year, a fractious divorce that left a raft of issues unresolved.
"This is a good deal... South Sudan will finally be able to focus its attention and dedicate its full resources to establish our state," Juba said in a statement.
Mutrif Siddiq, a Sudanese delegate to the talks in the Ethiopian capital, said the deal was "reasonable", although it did not meet the expectations of either side.
US President Barack Obama welcomed the deal, saying it opened the door to better prosperity for both countries.
"The leaders of Sudan and South Sudan deserve congratulations for reaching agreement and finding compromise on such an important issue, and I applaud the efforts of the international community, which came together to encourage and support the parties in finding a resolution," he said in a statement.
He also praised the mediation efforts of the African Union led by Mbeki, a former South African president.
US Secretary of State Hillary Clinton, who travelled to South Sudan's capital to meet President Salva Kiir on Friday -- just hours before the deal was struck -- also praised the agreement between the former civil war foes.
"The future of South Sudan is now brighter... for Sudan too, this agreement offers a way out of the extreme economic stress it is now experiencing," she said from the Kenyan capital Nairobi, on the latest leg of her Africa tour.
British Foreign Secretary William Hague said he welcomed the breakthrough agreement which "will be an important boost to the economies of both countries, and I commend the spirit of compromise both governments have shown."
-- Almost all S. Sudan revenue is oil --
The AU has been mediating year-long talks to try to resolve disputes that flared after South Sudan's independence in July 2011, the final stage of a 2005 peace deal to end one of Africa's longest civil wars.
Mbeki said both sides would meet next month to try to find a deal on the disputed border region of Abyei -- one of the most sensitive issues remaining -- with a new AU deadline set of September 22 to resolve outstanding issues.
Sudanese President Omar al-Bashir is expected to meet with Kiir next month, he added.
"We have reached a final agreement with South Sudan on oil transit, and we expect to settle other files under negotiation," Sudan's undersecretary at the petroleum ministry, Awad Abdul Fatah, told the official SUNA news agency.
A timetable will be drawn up for the resumption of oil production and exports, which are key to the economies of both deeply impoverished countries.
However, analysts suggest it could take up to six months for South Sudan to be able to resume full oil production. Oil generates about 98 percent of South Sudan's government revenue.
South Sudan took with it three-quarters of the oil held by the previously united nation, but the processing and shipping facilities remained in Sudan.
The two sides could not agree on how much Juba should pay to export its crude through northern pipelines and ports, leading the South to shut down production in January after Khartoum began seizing the oil in lieu of payment.
The deal struck lasts for three and a half years, Juba said, after which it hopes to have completed proposed export pipelines to Kenya or Djibouti.
Contentious issues remain.
Juba's chief negotiator Pagan Amum accused Khartoum of violating a peace plan drawn up by the AU in April, notably by bombing South Sudan, which he said laid it open to sanctions.
Sudan still accuses South Sudan of supporting insurgents on its territory, a charge analysts believe despite denials by Juba, which in turn accuses Khartoum of backing rebels on its territory.
The two countries fought along their contested oil-rich frontier in March and April, sparking fears of wider war and leading to a UN Security Council resolution that ordered a ceasefire.
In addition, Mbeki said an agreement had also been reached between Khartoum, the UN, the AU and the Arab League to allow for humanitarian access to Sudan's war-torn Blue Nile and South Kordofan states.
Fighting between Sudanese troops and rebels there has left thousands in a "desperate state" and in need of emergency aid, according to the UN.
Clinton urged "immediate implementation of this urgently needed assistance."