Speaking today, Col Ahmed al-Mesmari said one soldier is missing and 10 were wounded in the attack early yesterday.
Al-Mesmari says soldiers fighting for Libya's internationally recognised government chased the attackers, capturing many of their weapons and causing casualties. The spokesman says the soldiers "initially repelled the attack" and chased them into a neighbourhood known to be a stronghold of Ansar al-Shariah and Islamic State loyalists.
Libya has slid into chaos since the 2011 overthrow and killing of longtime dictator Moammar Gadhafi.