The state of emergency gives security forces more powers and limits the right of public assembly.
Tunisian authorities had already tightened security, deploying more than 1,400 armed officers at hotels and beaches.
President Beji Caid Essebsi said in a national address that “exceptional measures” were needed.
“In order to face up to this scourge we need to be prepared. We need to have enough troops, proper training and material means – we are in desperate need of material means,” he said, appealing for international counter-terrorism support and co-operation.
The state of emergency will be in place for a renewable period of 30 days.
An official from PM Habib Essid’s office said several officials had been sacked in the wake of the attack, including the governor of Sousse.
“Just as there have been security failures, there have also been political failures,” Dhafer Neji told AFP.
Security forces were criticized for not responding more quickly to the attack on June 26 in Sousse, when a gunman opened fire on tourists on a beach and in a hotel before being shot dead by police.
The gunman has been identified as student Seifeddine Rezgui, who authorities say had trained in Libya.
PM Habib Essid said Seifeddine Rezgui had probably trained with the Ansar al-Sharia group, though Islamic State (ISIS) earlier said it was behind the attack.
Eight people have been arrested on suspicion of collaborating with Seifeddine Rezgui, and the government says it has uncovered the network behind the Sousse attack.
Authorities have also pledged to close some 80 mosques that were operating outside government control and accused of spreading extremism.
The last time Tunisia declared a state of emergency was in 2011, in the uprising which overthrew President Zine al-Abidine Ben Ali. It was lifted in March 2014.
Officials are expected to pass a counter-terrorism bill that has been in parliament since early 2014 in the coming weeks.
Image source: Wikimedia Commons President-elect Donald Trump celebrated his election victory at the Ultimate Fighting…
Millions of voters across the US chose to return Donald Trump to the White House…
Donald Trump declares victory in the US election as he addresses jubilant supporters in Florida.…
Stocks around the world are rising as Donald Trump appears to be on the cusp…
Donald Trump has won Pennsylvania, North Carolina and Georgia and taken a lead over Kamala…
Quincy Jones, the celebrated musician and producer who worked with Michael Jackson, Frank Sinatra, Ray…