It is the second day of fighting against the Sunni militants, who are thought to be linked to Islamic State.
The spillover of the Syrian conflict has led to a surge in sectarian tension in Tripoli, with clashes common.
But it is the first time they have spread to the bazaar – a candidate for Unesco world heritage status.
The latest violence was sparked after Lebanese troops killed three militants and detained a local leader in a raid in the north of the city on Friday.
Fighting later erupted after gunmen targeted an army patrol in Khan al-Asker, near the heart of the city. The militants then retreated to the market, where clashes continued into Saturday afternoon.
An army statement said the gunmen were surrounded in the market, with several of them wounded during an exchange of fire. It said that fighting ended at approximately 14:00 local time (11:00 GMT).
“The army has ended its operation, having arrested a number of armed men and seized quantities of weapons and ammunition from them, while others fled and are being pursued,” it added.
Fighting also spread to other parts of the city, with reports that at least one civilian was killed and several others – including a local journalist – wounded.
The number of casualties among the gunmen was not immediately clear. Security officials could not confirm whether the gunmen were affiliated with any group, according to the AFP news agency.
Dozens of shops were destroyed in the market, with dozens of civilians, many of them women and children, trapped inside until the fighting stopped, the agency added.
Tripoli is sharply divided along sectarian lines, with tensions stoked by the continuing civil war in neighbouring Syria.
Clashes between opponents and supporters of Syrian President Bashar al-Assad have regularly erupted in the coastal city, but have rarely spread beyond one neighbourhood where tensions are highest.
On Friday, Lebanon announced it would no longer accept refugees from war-torn Syria, saying it had reached saturation point.
Lebanon has taken in 1.1 million Syrians despite having a total population of only just over four million.