Finance ministers from the 17 countries that use the euro have unanimously approved the terms for a bailout loan for Spanish banks of up to 100 billion euro ($A118.28 billion).
The document, signed off by the "eurogroup" of finance ministers following a teleconference on Friday, calls for strict monitoring of the banks that receive aid.
It also requires the Spanish government to present this month plans to reduce its budget deficit to under 3 per cent of gross domestic product by 2014.
"The eurogroup is convinced that the reforms attached to this financial agreement will contribute to ensuring a return of all parts of the Spanish banking sector to soundness and stability," the finance ministers said in a statement.
The agreement calls for an initial disbursement of 30 billion euro this month.
The full amount of money needed to shore up Spain's banks will not be known until September, after individual banks have been assessed.
"The aim of this program is very clear: to provide Spain with healthy, effectively regulated and rigorously supervised banks, capable of nurturing sustainable economic growth," Olli Rehn, the European monetary affairs commissioner said in a statement.
Prior to the bailout approval, Spanish Treasury Minister Cristobal Montoro said Spain's recession would drag on into 2013, although the economy would not be quite as weak as it was now.
He said GDP would contract 0.5 per cent in 2013. The previous forecast had been for the economy to grow by 0.2 per cent.
This year the economy would shrink 1.5 per cent, a slight improvement from the 1.7 per cent drop predicted until now, Montoro said.
He also said the Valencia region, one of Spain's most heavily indebted, had asked the government for liquidity.
The Ibex stock index fell 3.5 per cent on Friday, while the 10-year bond yield rose to 7.11 per cent.
Spain also raised its unemployment forecast for 2012 to 24.6 per cent from an earlier estimate of 24.3 percent.
On Thursday, tens of thousands of angry Spaniards protested in 80 cities throughout the country against the government's latest austerity package, blaming officials for "ruining" the country.
Protesters flooded Madrid's main square Puerta del Sol and the streets in front of parliament late into the night.
Large crowds also gathered in Barcelona and Bilbao, and the leading Spanish newspaper El Pais estimated that more than 100,000 had attended the rally in the capital.