Sudan and South Sudan on Tuesday averted a shutdown of economically vital oil flows and again pledged to implement economic and security pacts that have twice failed to take effect.
At the close of a one-day summit with his South Sudanese counterpart Salva Kiir, Sudanese President Omar al-Bashir said the South's oil will continue to move through Sudan for export on the Red Sea.
He pledged commitment to all agreements signed by Khartoum, and "that includes the flow of South Sudanese oil through Sudanese infrastructure" to Sudan's port.
In June, Khartoum accused the South of backing rebels on Sudanese soil and abruptly told oil companies they had 60 days to stop transporting the crude.
Khartoum extended the time-limit twice, with the latest deadline due to expire this Friday.
Crude oil exports are virtually the only source of foreign revenue for landlocked South Sudan.
Analysts expected Bashir would use the oil issue to try to win concessions from the South on matters including its alleged support for rebels in the north.
Observers say that, despite denials, both governments have aided insurgents on neighbouring soil.
"We are not supporting the rebels, and this can be seen in reality," Kiir said.
"We have to close the old chapters and open a new page," he said. "What we agreed in September has to be the end of all conflict."
In March, the two countries began implementing nine deals they signed in September last year but had failed to put into effect because of Khartoum's concerns over border security.
The agreements included a demilitarised buffer zone along the disputed and undemarcated boundary.
The pacts also led to a resumption of oil flows from the South, which pays fees to cash-starved Khartoum for using its pipelines.
Sudan would potentially earn billions of dollars from those payments, while billions more would reach Juba's treasury from the exports.
There was also agreement on the free flow of people and goods across the international frontier.
Just as the up-and-down relations between Sudan and South Sudan appeared to be improving, the Sudan Revolutionary Front rebel alliance widened its offensive aimed at toppling the regime.
Khartoum then froze the nine security and economic pacts in June, and threatened to shut the oil pipelines.
We are now taking new steps," Bashir told the summit, adding that his country is determined to have good relations.
"We respect all the agreements... and are committed to implementing them as one package," he said.
Kiir, too, said his nation would put all the agreements into effect.
"They can repeat it 10 times. Now what they have to do is start implementing them," a foreign diplomat told AFP, welcoming the end of the oil ultimatum.
"Two months ago the situation was much more tense. So I think we should encourage them."
Both impoverished countries fought border clashes last year which sparked fears of wider conflict.
"These two countries cannot always remain on a war footing. If they do that, they cannot offer services to their citizens," Kiir told a joint session with Bashir and several cabinet members from each side.
Bashir greeted Kiir on the Khartoum airport tarmac after he arrived on a Kenya Airways flight, wearing his trademark cowboy hat.
Sudan's Foreign Minister Ali Karti told reporters that the visit came at Bashir's invitation.
The foreign diplomat told AFP that Bashir and Kiir appeared to have made "a major change" in their approach to the flashpoint Abyei region, whose status remains unresolved.
Sudan and South Sudan did not meet deadlines which they agreed in March to set up Abyei's administrative structure.
In a joint statement at the close of their talks they pledged to build that administration quickly "to pave the way for the presidents to decide the final status of the Abyei area".
Leaving the issue to the presidents would mean the South was no longer backing an October referendum, the diplomat said.
The African Union had proposed the ballot to decide whether the territory belongs to the north or south, but Sudan disputed the suggested criteria for voter eligibility.
Kiir last visited Khartoum in October 2011, a few months after his country split from Sudan under a peace deal which ended a 23-year civil war.