The measure was included in the bill at the request of Catalan separatist party ERC, whose support is needed by Socialist Prime Minister Pedro Sanchez's minority government to pass legislation at national level.
The ERC helped approve Sanchez's 2021 budget on Tuesday in the Senate, prompting accusations from the main opposition conservative Popular Party (PP) that Sanchez was now “paying the price” with the education law reform.
“The price is throwing Spanish out the window of classroom in Catalonia forever,” the party's spokesman in the senate, Javier Maroto, said ahead of the vote.
Spain's regional languages were suppressed under the 1939-1975 dictatorship of Francisco Franco and the issue remains hugely sensitive – particularly in Catalonia, a northeastern region home to some 7.5 million people.
After Spain returned to democracy following Franco's death in 1975, education became the responsibility of its regions – including those like Catalonia, Galicia and the Basque Country that have their own languages, with equal status under the law.
As a result, in wealthy Catalonia classes in public schools have for decades been taught in Catalan, with only two hours a week in most cases set aside to learn Spanish.
A previous PP government tried to change this by reforming Spain's education law in 2013 to include a reference that Spanish is the language of instruction of the nation's schools. But in practice the reference was ignored and classes continued to be delivered mainly in Catalan in the region.
The Catalan nationalists who govern the region argue this policy is needed to protect the language and say that, even four decades after Franco, it remains vulnerable.
Sanchez has defended the bill, saying it reflected Spain's “linguistic plurality” which he said was a “huge asset to society as a whole”.
The reform of the education law which was approved by the lower house of parliament last month also downgrades religious teaching and restricts state funding for Catholic charter schools.
It has sparked a backlash from some parents in Catalonia who fear their children's command of Spanish, one of the world's most widely spoken languages, will not be as strong as long as they are schooled mostly in Catalan.
Conservative parties have warned that the reform threatens national unity in a country that is still grappling with the fallout from Catalonia's failed 2017 bid to break away from Spain as it will encourage the development of a regional identity.
Waving flags from cars and honking horns, thousands of people protested in Madrid, Barcelona, Malaga and other cities on Sunday against the reform, dubbed the Celaa law after Education Minister Isabel Celaa. Similar demonstrations were held last month.
“It is not a law against anyone, as will be seen in the future,” Celaa said after the law was passed.
The protests were backed by the PP, far-right party Vox and centre-right Ciudadanos, who have all vowed to challenge the law in Spain's Constitutional Court.
Speaking to reporters at the protest in Barcelona on Sunday, the leader of Ciudadanos in Catalonia, Carlos Carrizosa, called the law “abusive”. “Spanish speaking students cannot study their first words in their maternal language,” he told reporters at the protest in Barcelona on Sunday.