The insurgents attacked Iraq’s Baiji refinery a week ago by blasting through the security perimeter around it and taking over several installations, including storage tanks.
A spokesman for Iraq’s counterterrorism forces told Reuters troops protecting the refinery had now retaken most facilities, although there were still small pockets of insurgents left on the site.
“We expect to regain full control within a couple of hours,” Sabah al-Noamani said.
Iraqi forces retook Baiji refinery from militants once before last November, but lost control of it again.
Islamic State insurgents suffered a major defeat this month when Iraqi troops and Shi’ite paramilitaries routed them from the city of Tikrit, but struck back at Baiji and in the western province of Anbar.
Thousands of families have fled Anbar in recent days as Islamic State militants gained on Ramadi and local officials warned the city was about to fall.
Two members of the Anbar provincial council and police Major Khalid al-Fahdawi who is stationed inside Ramadi said reinforcements were on the way and the city was no longer in immediate peril.
“The danger is still there, but the situation is better than yesterday,” provincial council member Sabah Karhout told Reuters.