A military spokesman said troops had repelled repeated attacks by the militants, led by the jihadist Islamic State in Iraq and the Levant (ISIS).
Forty assailants were killed overnight and on Wednesday, he added, denying the facility was close to being overrun.
But some workers said the militants had seized most of it and that troops were concentrated around the control room.
It comes as President Barak Obama considers a formal request from Iraq’s government for air strikes against the militants, who have seized several northern cities and towns since last week.
ISIS-led militants launched an assault on the Baiji refinery, about 130 miles north of the capital Baghdad, early on Wednesday.
Workers trapped inside said the attackers had breached the perimeter and destroyed one of its fuel tanks. Some said they had taken control of most of the facility. Video footage showed smoke billowing from the refinery and the black flag used by ISIS flying from a building.
However, officials insisted that troops had resisted the advance.
Nearly all the 15,000 workers at the refinery and 100 foreign experts left on Tuesday when the plant was shut down in anticipation of the attack.
On Thursday morning, the remaining 250 to 300 workers were evacuated under an agreement brokered by local tribal leaders, one of the workers told the Reuters news agency.
The battle over Baiji, which supplies much of the country’s domestic fuel, has sparked fears that Iraqis will soon experience long lines at petrol pumps and electricity shortages.
On Wednesday there were fierce clashes in the Baquba, about 37 miles north of Baghdad, as jihadists again tried to enter the city centre and seize its prison.
Shia militiamen have been sent to assist in the defense of the capital of Diyala province, which has effectively become a frontline, and the nearby city of Samarra, site of a major Shia shrine.
PM Nouri al-Maliki has tried to assure Iraqis that the momentum is shifting.
The Iraqi government is awaiting President Barack Obama’s decision on air strikes.
On Wednesday, the chairman of the US Joint Chiefs of Staff, Gen. Martin Dempsey, warned that the US military still lacked sufficient intelligence to take action. He told a congressional hearing that pilots would have difficulty knowing who they were attacking from the air.
Asked if the intervention might come too late, Gen Dempsey said: “There is very little that could have been done to overcome the degree to which the government of Iraq has failed its people. That is what has caused this problem.”
ISIS has exploited deep resentment among Iraq’s minority Sunni Arabs, who have long accused Nouri al-Maliki of discriminating against them and monopolizing power.
1svvy-HI0D8Image source: Wikimedia Commons President-elect Donald Trump celebrated his election victory at the Ultimate Fighting…
Millions of voters across the US chose to return Donald Trump to the White House…
Donald Trump declares victory in the US election as he addresses jubilant supporters in Florida.…
Stocks around the world are rising as Donald Trump appears to be on the cusp…
Donald Trump has won Pennsylvania, North Carolina and Georgia and taken a lead over Kamala…
Quincy Jones, the celebrated musician and producer who worked with Michael Jackson, Frank Sinatra, Ray…