The lower house of parliament approved the law -- dubbed the "Ley Mordaza" or "Gag Law" by its critics -- on Thursday with the votes of the ruling conservative Popular Party which has a majority in the assembly. All opposition parties voted against the bill.
The bill, which was first introduced in 2013, now goes to the senate, Spain's upper house of parliament, at the beginning of next year for final approval.
Under the new legislation organisers of unpermitted demonstrations near buildings that provide basic services can be slapped with fines of up to €600,000 ($745,000) while those who disobey police or prevent authorities from carrying out evictions can be fined up to €30,000.
Interior Minister Jorge Fernandez Diaz argues the new legislation serves to "better guarantee public security in a way that has more legal certainty" and will better protect rights and freedoms.
Passage of the bill, which updates a 1992 law, comes as Spain has seen a rise in protests since the collapse of a property bubble in 2008 sent the economy into a double-dip recession that threw millions of people out of work.
Prime Minister Mariano Rajoy's Popular Party government has issued a series of austerity measures which have been targeted by demonstrations, including tax hikes and deep cuts to public spending in education and healthcare, since taking power in 2008.
While the vast majority of protests have been peaceful, some -- such as an attempt by demonstrators to encircle parliament in September 2012 -- have ended up in clashes with police.
The rise in protests led Madrid's Popular Party mayor Ana Botella to request that demonstrations be restricted in the city centre.
Opposition parties and rights groups argue the new law is an attempt by the government to curb protests over its handling of Spain's economic crisis.
"The law essentially aims to discourage people from exercising their fundamental rights," Joaquim Bosch, the spokesman for Judges for Democracy, an association of judges and magistrates, told AFP.
"What the government wants are parallel regulations to sanction protests"
An amendment recently introduced to the bill would make it legal for Spanish police to immediately deport migrants caught illegally entering north African territories of Melilla and Ceuta, a main gateway into Europe for migrants seeking a better life in Europe.
Rights groups accuse Spanish police of routinely expelling back to Morocco immigrants who have entered the two territories illegally.
These expulsions are prohibited by 11 Spanish, European and international legal norms because they deny migrants their right to seek asylum, according to rights group Amnesty International.
"It is not a humanitarian question, or a sentimental issue, it is a question of human rights," said the head of the Amnesty's Spanish branch, Esteban Beltran.
United Nations refugee agency UNHCR said in October that it was "concerned" by the move to make on-the-spot expulsions legal at the same time that it urged Spanish authorities "not to use violence at the borders" after an NGO released a video of police hitting migrants who had scaled a border fence in Melilla.
"There is a lot of hypocrisy, from offices in the north of Europe who are not facing this problem, from the centre of Europe and other places that give lessons on humanitarianism," Fernandez Diaz said Thursday during a television interview.
"I would say 'give me your address' and we will send these people with the commitment that they will support them and give them a job," he added.
Amnesty International also criticised a measure in the new law which allows for fines of up to €30,000 for those who use images of police without authorisation. It says this could deter activists and journalists from relaying images of alleged police brutality.