The gunmen opened fire near hotels in the resort town of Sousse.
Interior Ministry Spokesman Mohammed Ali Aroui confirmed the fatalities, and said one of the gunmen was killed and police were pursuing another.
Photos of an alleged suspect dead at the scene and various pictures posted by people saying they had barricaded themselves inside hotel rooms in the area surfaced on social media.
Tunisia, a popular destination for European and Tunisian travelers, has been on high alert since adeadly assault on the famed Bardo museum in March by a pair of gunmen who killed 22 people at the tourist attraction in the capital city of Tunis.
The gunmen opened fire on tourists getting out of buses and then entered the museum, apparently unimpeded, and fired on more tourists inside. Two gunmen were killed in a shootout with police. Four Italians were among the dead.
The Islamic State in Iraq and Syria (ISIS) claimed responsibility for the Bardo attack.
While Tunisia was the first nation hit by unrest associated with the “Arab Spring” in 2011, it had largely avoided major violence in the years since, as neghboring Libya descended into choas and civil war gripped Syria.
The Bardo attack, carried out by ISIS adherents returning from Libya, marked the first major attack by Sunni extremists on tourists in the country.