Suspected Islamic State group militants staged an attack on a power and water plant about 80km (50 miles) from the major Sarir oil field in eastern Libya late on Monday, an oil facilities guard said.
Security forces foiled an attempted suicide car bombing by killing the driver, before engaging the attackers in clashes, the guard said. An engineer and a resident also confirmed the attack.
Any threat to the Sarir area would cause particular alarm because more than half of Libya's remaining oil production comes from the region.
No group immediately claimed the attack, but Islamic State group fighters have previously targeted against oil installations in Libya, stepping up their campaign against export terminals in the east of the country at the start of this year.
As Libya's intermittent conflict has dragged on, production has fallen to about 3,60,000 barrels per day, less than a quarter of its level before the fall of Muammar Gaddafi in 2011.
Militants loyal to the Islamic State group have exploited political chaos and a security vacuum to establish a foothold in the country. They took control of Sirte last year, and have a presence in several other towns and cities.
The group has caused extensive damage to oil infrastructure, but has not taken over facilities and profited from them as it has in Iraq.
Western powers have been searching for ways to stop Islamic State group's expansion in Libya, but have been frustrated by recent delays to the formation of a U.N.-backed unity government.