The closure has led to production losses of up to 450,000 barrels per day (bpd) and two oil storage tanks were destroyed or badly damaged by fires during the fighting.
For the past week, Haftar's Libyan National Army (LNA) has pounded the area with air strikes as it mobilised to retake the ports, and it continued to target its rivals with air strikes on Thursday as they retreated.
Haftar is one of the key figures vying for power in Libya since the country fragmented following a NATO-backed uprising in 2011. He has received increased international recognition since seizing the oil crescent ports in 2016 and allowing the NOC to reopen them, despite his rejection of a U.N.-backed government in the capital Tripoli.
Ahmed al-Mismari, a spokesman for the LNA which Haftar built up during his three-year campaign to seize Libya's eastern city of Benghazi, said troops had retaken Es Sider by mid-morning and were clashing with opponents as they advanced west.
He said Ras Lanuf, which includes a residential town, an air strip, storage tanks and a refinery, alongside the oil terminal, had also been taken by the LNA, though a military source said clashes had later resumed there.
LNA officials said their rivals had fled to the west and south, into the desert, suffering heavy losses in fighters and equipment.
Medical and military sources confirmed seven deaths among LNA forces. The LNA was able to free three fighters who had been held captive, one military official said.
Libya's national production has been cut to between 600,000 and 700,000 bpd from more than one million bpd during the oil crescent clashes, but NOC Chairman Mustafa Sanalla said he was expecting a quick restart.
Production at AGOCO, an NOC subsidiary based in the east, has fallen from around 250,000 to 180,000, an oil official said on Thursday, due to power problems and to disruption at Ras Lanuf.
"Libyan production is very low but we are going to resume very soon," he told reporters in Vienna. "After a couple of days we will resume, we start our operations hopefully."
The NOC has blamed the attack on the terminals on militias led by Ibrahim Jathran, who blockaded oil crescent ports for several years before losing control of them in September 2016 to the LNA.
The LNA has said the Benghazi Defense Brigades (BDB), a coalition of anti-Haftar fighters that previously tried to advance on Benghazi and seized Ras Lanuf and Es Sider for 10 days in March 2017, were also involved. Both sides have drawn on mercenaries recruited from Libya's south and from Chad and Sudan.
Jathran, who is from the oil crescent region, said he attacked the ports last week to "overturn injustice" against local residents by the LNA. The LNA was accused of abuses and mass arrests after using tribal alliances to win the ports two years ago.
Haftar is the dominant figure in eastern Libya, aligned with a government and parliament based in the east since 2014. Backed by regional allies including Egypt and the United Arab Emirates, he has controlled Benghazi, which lies northeast of the oil crescent, since late last year.
His forces have recently been stretched thin after launching a ground offensive last month to capture Derna, the only city in the east outside their control.
(Writing by Aidan Lewis; Editing by Janet Lawrence) ((Aidan.Lewis@tr.com; +216-29850352;))