Libya's government says it has resumed control of two eastern oil terminals, Ras Lanuf and Sidra, that were seized by rebels last year.
The government said the move, which resulted from an agreement with the rebels, ended the country's oil crisis.
Rebels originally seized four terminals as they demanded more regional autonomy. The two other ports were returned to the government in April.
The country's exports have been badly hit by the oil blockade.
"Today we regained control of the ports at Ras Lanuf and Sidra," Libya's acting Prime Minister Abdullah al-Thani said at a joint news conference with rebel leader Ibrahim Jathran.
"We have successfully reached an agreement to solve the oil crisis," he added.
Mr Jathran confirmed the deal, describing it as a goodwill gesture.
The two oil terminals have a combined capacity of about 500,000 barrels a day of crude oil. However, exports could still be affected by technical delays.
Before the blockade, Libya' usual oil capacity was about 1.5 million barrels per day.
Libya has been hit by instability since the overthrow of long-serving ruler Col Muammar Gaddafi in October 2011.
Militias rule large swathes of territory, with successive governments struggling to exercise control.