South Africa and South Sudan signed an outline agreement on Friday that could see Pretoria invest around $1 billion (880 million euros) in South Sudan's struggling oil industry.
The agreement, which will be subject to detailed negotiations between the countries, was made between two state-owned companies, South Africa's Central Energy Fund and South Sudan's Nile Petroleum Corporation.
South Sudan's oil minister Ezekiel Lol Gatkuoth said the investment will go into building a refinery and pipelines as well as oil exploration and training of workers and engineers.
South Sudan currently produces around 155,000 barrels per day, less than half of what production was at the start of the latest civil war in December 2013.
The country does not have its own refinery, so it currently sends crude by pipeline across the northern border to Sudan for processing and export, and imports refined fuels.
"When this refinery is complete it will have a capacity of producing 60,000 barrels of oil per day," said South Africa's energy minister Jeff Radebe.
"The whole project, the block exploration together with the refinery, the pipelines, we are looking an investment of more than one billion US dollars," he said.
The agreement between the two countries comes a day after South Sudan hosted a three day oil and power conference in Juba aimed at attracting investors.
The country's warring parties in September signed a new peace deal to end five years of civil war that has killed an estimated 380,000 people and crippled the oil industry, which funded about 98 percent of its budget.