"An armed group carried out an attack this morning on the prison located on the Mitiga air base, to try to free the detainees," the airport security official said.
Read: Islamic State claims killing of Egypt police general
"First there was an explosion... and then a clash with automatic weapons," he said, adding that at least eight attackers died.
An AFP journalist who was at the airport heard a blast followed by gunfire.
IS later claimed the attack on Twitter.
Flights were unaffected by the incident at what is the only airport still functioning in the militia-held city.
Mitiga is a military airfield used for civilian traffic after Tripoli's international airport was seriously damaged last year in fighting for control of the capital.
Extremists have exploited the turmoil in Libya since the fall of veteran leader Moamer Kadhafi in 2011 to establish a foothold in the energy-rich North African country.
Read: Britain says killed 330 Islamic State fighters in air strikes
IS militants in June took over the coastal city of Sirte, 450 kilometres to the east of Tripoli.
Over the past few months, they have claimed several attacks in the Libyan capital, mostly against embassies.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ