Armed men on Monday stormed the headquarters of Libya's National Oil Company in Tripoli where a blast and gunfire were heard, witnesses and a security source said.
They said the building near the city centre had caught fire and was surrounded by security services.
There was no official confirmation of any casualties.
"The security services are looking for gunmen in the building, but our priority is to evacuate the civilians stuck inside," said Ahmed Ben Salem, a spokesman for al-Redaa, a militia that operates as Tripoli's police force.
"The situation is under control," he said.
He was not able to provide details on the identity of the attackers.
An oil company official, who asked not to be named, said masked gunmen had exchanged fire with guards and attacked the firm's headquarters.
"I jumped out of the window with other colleagues, and then we heard an explosion," the official said.
No group has so far claimed the attack.
It comes four months after suicide bombers struck the headquarters of Libya's electoral commission, killing 14 in an attack claimed by the Islamic State group.
Libya's vital oil sector has been repeatedly disrupted by violence since a 2011 NATO-backed rebellion that toppled longtime dictator Moamer Kadhafi.
Petrochemical exports had accounted for the vast majority of state revenues under Kadhafi's rule, with production at 1.6 million barrels per day.
But since his ouster, output fell to about 20 percent of that level, before recovering to more than one million barrels per day by the end of 2017.
Oil producers' cartel OPEC has estimated Libya's oil reserves at 48 billion barrels, the biggest in Africa.
Two rival governments and a range of armed groups are struggling for control of Libya and its resources.