Tripoli's Mitiga International Airport had just reopened after it was forced to close for a week because of deadly clashes between rival militias.
Rockets were fired late on Tuesday in the direction of the airport in Libya's capital, residents said, forcing flights to be diverted, less than a week after the United Nations brokered a fragile truce between rival armed groups in Tripoli.
A spokesman for a faction controlling Matiga airport, the only one functioning in the capital, said there were no casualties or damage. Libyan channels reported that several people had been wounded by the rockets, one of which landed in the Mediterranean sea.
Rival groups have been fighting in Tripoli for several days but clashes had been focused on the south of the city. Matiga airport lies in an eastern suburb.
A Libyan Airlines flight bound for Tripoli from Alexandria, Egypt, was diverted to Misrata, the airport said on its Facebook page. Misrata lies about 190 kilometres east of Tripoli.
A spokesman for Misrata airport said that all flights bound for Tripoli would be diverted to Misrata.
Separately, Daesh claimed responsibility for a shooting attack on the headquarters of Libyan state oil company NOC in Tripoli.
The attack on Monday killed two NOC staff and wounded 10, said officials, who had described the three shooters who were also killed as "Africans."
It targeted the "economic interests of oppressing governments funding crusaders," a statement carried on its Amaq news agency said.
It was the first attack of its kind against the leadership of Libya's state oil industry.
Libya has been divided into rival administrations but NOC has continued to function relatively normally across the country, which relies on oil exports for most of its income.
Militants loyal to Daesh have previously carried out attacks in Tripoli and other towns, despite having lost their stronghold in the central city of Sirte late in 2016.
In May, Daesh claimed a deadly attack on the national election commission offices in Tripoli.