The operation is ongoing, an interior ministry spokesman told AP news agency.
Tunisia has declared a state of emergency after 38 tourists were killed in an attack by an Islamist gunman in the beach resort of Sousse on 26 June.
Thousands of British tourists have left the country after a new travel alert from the UK foreign office.
It said that another terror attack in the country was "highly likely" and urged Britons to leave.
Other countries like Germany and France, however, have not followed suit.
France, which accounts for the largest number of tourists in Tunisia, says its nationals should be "particularly vigilant" but has stopped short of telling them to leave.
Germany said it was sending a team to assess the security situation in Tunisia in the next few days.
Source: Tunisian national institute of statistics
Officials have not suggested there is a link between the mountain operation and the June attack.
The army has been trying to dislodge militant groups from the mountains near the border with Algeria for several years.
Military helicopters have been pursuing other suspects as part of the operation being led by the Tunisian army and national guard, an unnamed security source told Reuters news agency.
It is not clear which group the militants killed in the operation belong to.
The Sousse gunman has been identified as student Seifeddine Rezgui, who authorities say had trained in Libya.
Tunisian Prime Minister Habib Essid told the BBC that Rezgui had probably trained with the Ansar al-Sharia group, though Islamic State (IS) earlier said it was behind the attack.
Live news updates from Africa
Tunisian security forces have killed five suspected Islamist militants in the mountains near the central town of Gafsa, officials say.