Tony Blair's controversial plan for a new law to stop people "glorifying" terrorism has been backed by MPs.
The Terror Bill has had a rough passage through Parliament
The House of Lords voted last month to remove the measure from the Terrorism Bill, but the Commons has now voted by 315 to 277 to reinstate the plan.
Mr Blair said the vote was a "signal of strength" which could outlaw placards glorifying the bombers who attacked London last July.
But the Tories accused Mr Blair of "ineffective authoritarianism".
The Lib Dems and Tories both opposed the law.
They said existing laws - and plans for a new offence to prevent indirect encouragement of terrorism - mean the glorification offence is not needed.
Seventeen Labour MPs rebelled in the vote and some others abstained, reducing the government's usual majority of 64 to 38.
The Terrorism Bill was introduced after July's bomb attacks in London.
It has suffered a rocky ride in Parliament, with MPs voting down plans to allow police to hold suspects for up to 90 days without charge.
Wednesday's vote sets up a potential battle with the House of Lords.
Opposition peers will have to decide whether to continue their battle against the glorification offence when the bill returns to the Lords.
The Commons debate also saw MPs reverse another change imposed by the Lords.
MPs said police should not need a warrant from a judge to be able to tell internet service providers to remove terrorist material from websites.
The return of the bill to the Commons comes after MPs overturned a Lords defeat on plans to make ID cards compulsory for all new passport holders.
Acting Lib Dem leader Sir Menzies Campbell called the government's plans a "distraction".
"The purpose of passing legislation is not to 'send a message', as the prime minister seems to argue. It is to change the law," he said.
But Mr Blair said dropping the glorification offence would prove counter-productive.
Reacting to the vote, Mr Blair said Parliament had shown it wanted to tackle not only those directly committing terrorist acts but also people who encouraged terrorism.
The prime minister said the law would allow action to be taken against people with placards glorifying the 7 July bombers - which were seen in London during protests against cartoons satirising the Prophet Muhammad.
But the Tories accused ministers of trying to grab headlines rather than create watertight laws.
Conservative shadow home secretary David Davis attacked suggestions his party was "soft on terrorism".
He said opponents of the glorification clause included people like ex-Cabinet minister Lord Tebbit, whose wife was still disabled from a terrorist attack.
"All these people want to get the best outcome for the law," said Mr Davis. "We are not playing politics with terrorism, arguably Mr Blair is, I am afraid."
Home Secretary Charles Clarke said the glorification clause was needed to act against organisations which tried to promote terrorism and created an atmosphere where impressionable young men thought suicide bombings were a "noble and holy activity".