The move follows two deadly attacks on tourism sites - a beach and hotel at Sousse in June and the Bardo Museum in Tunis in March.
Under the new law, those convicted of terrorism could face the death penalty and expressions of support for terrorism are a jailable offence.
However, rights groups have criticised the new measures as draconian.
MPs passed the law overwhelmingly after three days of debate.
Mohamed Ennaceur, president of the assembly, called it a "historic" moment and said the new law would "reassure" Tunisians.
The law will also make it easier for investigators to tap suspects' phones.
Advocacy groups have warned that the law's definition of terrorist crimes is too vague and they say it fails to safeguard the rights of defendants.
The new powers allow authorities to detain suspects for 15 days without access to a lawyer or appearance before a judge.
Critics have also condemned the return of capital punishment after a lengthy moratorium on executions.
A gunman killed 38 people in Sousse on 26 June in an attack claimed by the jihadist group Islamic State (IS).
In March, 21 tourists died when gunmen stormed the Bardo museum in the capital, Tunis.
IS later said it was behind the raid.
Tunisia's parliament has adopted a new anti-terror law which seeks to counter the threat posed by Islamist militants.