Among the dead were a woman and her son, killed by a rocket in the Bab al-Tebanneh district, a mostly Sunni Muslim community which supports Syria's anti-regime opposition, the official said.
At least five were wounded in Jabal Mohsen, an area mainly populated by pro-Damascus Alawites.
News that makes sense
Your trusted source for staying up-to-date with the world around you. Get free daily news updates and analysis, straight to your inbox.
Sporadic gun and rocket fire broke out at midnight and continued through the night, forcing some residents of the port city to flee their homes.
The army and police were later being deployed in Tripoli, the source said.
Sectarian violence has flared on a number of occasions in Tripoli since the revolt broke out in neighbouring Syria in March last year, including deadly street battles in May.
Bab al-Tebbaneh and Jabal Mohsen have been gripped by frequent fighting, reflecting a split between Lebanon's parties where the opposition backs the revolt in Syria while a ruling coalition led by Hezbollah supports the Damascus regime.
