KHARTOUM, Sudan — Sudan and South Sudan, moving to reduce the hostilities that have severely weakened both of their economies, signed an agreement early Tuesday morning that could lead to the resumption of oil production in two weeks.

“Resumption of production shall take place as soon as technically feasible,” the agreement read.

South Sudan became independent of Sudan in 2011, taking with it nearly three quarters of the oil wealth. The pipelines, refinery and port to export the oil, however, are in Sudan.

The two sides, longstanding enemies that fought one of Africa’s longest and costliest civil wars, have been at odds for decades, and South Sudan halted oil production in January 2012 in a dispute with Sudan over transportation fees. Both countries came close to full-out war in April 2012.

Both countries have suffered from the loss of oil revenues, with South Sudan depending on oil for 98 percent of its revenue.