Eurozone finance ministers have approved an agreement to lend up to $123bn to Spain so it can recapitalise its banks.
"We have formalised what we discussed in the past two Eurogroup meetings," Luc Frieden, Luxembourg's finance minister, told reporters on Friday.
"We have formally approved the memorandum that lays out the conditions under which Spain can be lent money for the recapitalisation of its banks," Frieden said.
In a conference call, ministers signed off on a lengthy memorandum of understanding with Spain spelling out the terms of the aid, which will be fully disbursed by the end of 2013.
But before Spain can decide exactly how much money it needs, it must see the results of in-depth audits of its banking sector, which is riddled with bad property loans.
"The approval of all 17 ministers is there, and that means that the programme can continue. Money will not flow immediately, because work on the analysis of the specific banks is ongoing."
The bank rescue, and fresh austerity measures and looser fiscal targets agreed with Madrid, are aimed at avoiding a full sovereign bailout that the eurozone can barely afford.
There are signs of growing discontent at the economic pain being heaped on the Spanish public.
Live Box 201192615204954678
Hundreds of thousands of Spaniards marched against the centre-right government's latest measures on Thursday evening, following more than a week of demonstrations across the country.
Parliament approved on Thursday a package of $80bn of spending cuts and tax hikes which are likely to deepen the recession in which the eurozone's fourth-largest economy is mired.
Under the bailout memorandum, 14 banking groups that make up about 90 per cent of Spain's banking system will be tested for their recapitalisation needs in a review due to be completed by the second half of September.
Madrid expects $36.6bn in a first tranche of money that will be available immediately for state-rescued banks that urgently need funds.
Spain's three biggest banks - Banco Santander, BBVA and Caixabank - would not need extra capital even in a stressed scenario, the independent audit said.
It also said immediate problems were limited to four banks: Bankia, CatalunyaCaixa, NovaGalicia and Banco de Valencia, the last three of which have been nationalised.