Two Libyan oil terminals are due to reopen after the government and rebels reached an agreement.
Libya's justice minister said the terminals of Zueitina and Hariga would reopen on Sunday.
Two other ports, Ras Lanuf and Es Sider, will be reopened after two to four weeks of negotiations.
Oil traders have been watching the talks closely, keen to know when Libyan oil is going to re-enter the market after eight months of disruption.
Zueitina is located to the south of the city of Benghazi and Hariga is east of the city.
Potentially the two ports could increase Libya's crude oil exports by about 200,000 barrels per day.
That would be a big boost to the nation's output, which is currently running at around 150,000 barrels per day.
"The ports Zueitina and Hariga will be handed over to the state with the signature of this agreement.
"The protesters are banned from returning or obstructing work at the ports," Justice Minister Salah al-Marghani said.
Under the agreement the government will pay compensation to the rebels, drop charges against them and reverse its threat of a military offensive.
Rebels have been demanding a greater share of Libya's oil wealth and more regional autonomy.
Negotiations between the two sides have been difficult and previous agreements have broken down.
Agencies