Three of the victims, including a 12-year-old child, were civilians, said emergency services spokesperson Osama Ali. Another 30 people were wounded.
It was the second day of violence in the city and came shortly after one of the country's competing governments called for the clashes to stop.
The North African country has been experiencing a period of relative peace following almost a decade of violent civil war.
It was not clear if the fighting was connected to the ongoing political rivalries between the two governments and their associated militias.
The clashes broke out in a central district where several government buildings, diplomatic missions and international agencies are located, before spreading to other areas.
The shooting began in the middle of the night and lasted for hours. The violence led to Mitiga airport to suspend flights over safety concerns.
The Libyan Presidential Council had called on all forces involved in fighting on Thursday to withdraw and return to their bases.
Reuters news agency reported that the main groups that had been part of the fighting were, however, connected to the council, including the powerful RADA force.
A country divided
Libya has been split into two regional administrations between the east and west for years. Each has its own loyal militias and foreign state supporters.
The country has been beset by turmoil ever since the NATO-backed uprising against former dictator Moammar Gadhafi in 2011.
Prime Minister Abdul Hamid Dbeibah, based in the western city of Tripoli, threw the country's democratic transition into chaos last year by not holding an election to choose a successor for the interim administration that he heads up.
Rival lawmakers in the eastern city of Sirte then elected their own prime minister, Fathi Bashagha, in response.
An earlier attempt by Bashagha to establish his government in Tripoli ended with him withdrawing after clashes that killed one person.
ab/wd (AP, Reuters)