TEHRAN, Young Journalists Club (YJC) - An oil company official, who asked not to be named, said masked gunmen had exchanged fire with guards and attacked NOC's headquarters in the capital Tripoli.
"I jumped out of the window with other colleagues, and then we heard an explosion," the official said.
The UN and the internationally recognized Government of National Accord (GNA) denounced what they called a "terrorist" attack.
The assault was the latest to target Libya's vital oil sector -- which provides 95 percent of state revenues -- amid the chaos that has gripped the North African country since the 2011 uprising that toppled late dictator Moamer Kadhafi.
Witnesses also spoke of hearing a blast and gunfire before security forces rapidly surrounded the headquarters and firefighters and rescuers arrived on the scene.
"Two NOC staff were killed in the attack. Additionally 10 employees were injured," the oil company said in a statement confirming a toll from the health ministry.
NOC said the assault began with "a number of explosions inside the building and intense shooting" then a number of staff were "temporarily held hostage" before security forces intervened and freed them.
NOC chairman Mustafa Sanallah, who was among those evacuated from the five-storey building, praised the "swift response of the emergency services and the security teams" who helped put an end to the attack, the statement said.
Ahmed Ben Salem, a spokesman for the Deterrence Force, a militia that operates as Tripoli's police force, said the remains of two "suicide bombers" were found inside the building.
Tripoli security chief Salah al-Semoui blamed Daesh for the attack, although there was no immediate claim of responsibility.