Spain's King Juan Carlos signed into law on Tuesday a constitutional amendment aimed at capping future budget deficits.

He endorsed the document in a solemn ceremony at Zarzuela palace with Prime Minister Jose Luis Rodriguez Zapatero and the leaders of Parliament and the judiciary in attendance.

First proposed on Aug. 22, the revision to Article 135 of Spain's constitution is the fruit of a pact between the governing Socialists and the conservative main opposition Popular Party, currently leading in the polls for the Nov. 20 general elections.

The day before the Senate voted to approve the amendment saw nationwide protests against the measure organized by Spain's two largest labor federations, leftist groups and elements of the May 15th Movement, which was behind massive mobilizations earlier this year to denounce austerity policies and demand "real democracy."

Critics of the budget amendment demanded a referendum, insisting that Spanish voters should be allowed to have their say on an issue of such importance.

The Socialists and the PP, however, said the economic situation was so pressing that the amendment had to be passed and enacted before dissolving the current Parliament ahead of November's balloting.

The amendment is the first change to Spain's post-Franco democratic charter since 1992, when the constitution underwent minor adaptations to accommodate the European Union's Maastricht Treaty.

Zapatero, who announced months ago that he would not seek a third four-year term, has said the amendment will send a positive message to financial markets worried about Spain's large public debt.

The text of the constitutional amendment calls for a deficit approaching zero by 2020, but leaves the details for a subsequent piece of legislation to be debated and passed by the Parliament elected in November.