Islamist fighters attacked army and police barracks in the Tunisian town of Ben Guerdan near the Libyan border on Monday.
According to reports from residents and the Interior Ministry at least 30 people, including civilians, were killed in the clashes.
The report said that authorities had sealed- off the nearby beach resort town of Djerba, a popular destination for foreign and local tourists, and closed two border crossings with Libya.
It was not immediately clear if the attackers crossed the border, but Monday’s assault was the type of militant operation Tunisia’s government had feared as it prepares for potential spill over from Libya, where Islamic State militants have expanded their presence.
Reports say local television broadcast images of soldiers and police crouched in doorways and on rooftops as gunshots echoed in the centre of the town.
Bodies of dead militants lay in the streets near the army barracks, local residents said.
“I saw a lot of militants at dawn; they were running with their Kalashnikovs.
“They said they were Islamic State and they came to target the army and the police,” Hussein, a resident said.
Soldiers killed 21 militants and arrested six after they attacked military and police posts, the Interior Ministry said.
Hospital sources said at least seven civilians were killed along with a soldier and a customs agent.
While Tunisia has been held up as a model of democratic transition since its 2011 uprising against ruler Zine El-Abidine Ben Ali, the North African country is also caught up in a struggle with Islamist militancy.
More than 3,000 Tunisians have left to fight with Islamic State and other groups in Syria and Iraq.
Tunisian security officials say increasingly they are returning to join the militant group in Libya over the border.