Eurozone finance ministers have agreed to offer Spain an initial 30 billion euros by the end of this month to help its struggling banks.
The payment is the first instalment in up to 100 billion euros that European leaders agreed to loan to recapitalise Spanish banks which have been hit hard by falling property values and exposure to their government's bonds.
The agreement was reached after nine hours of talks in Brussels among the 17 finance ministers.
As per an agreement struck at the European leaders meeting at the end of June, eventually the loans will go directly from European bailout funds to the banks directly so that the Spanish government is not burdened with more debt.
The president of the Euro Group, Luxembourg prime minister Jean-Claude Juncker, says the group will formally sign the agreement later this month.
"We are aiming at reaching a formal agreement in the second half of July, allowing for a first disbursement of 30 billion euros by the end of the month to be mobilised as a contingency in case of urgent needs in the Spanish banking sector," he said.
Spain has also been given an extra year to pull its budget deficit back below the euro limit of 3 per cent of gross domestic product.
The new deficit targets are 6.3 per cent this year, 4.5 per cent in 2013 and 2.8 per cent in 2014.
The EU commissioner for economic affairs Olli Rehn has acknowledged that is a tough ask given that Spain is in a deep recession.
"This is a challenging but achievable objective.
Above all, it is a necessary objective," he said.
"It is essential that the multiple challenges Spain is facing and action to restore sustainability to its public finances are addressed." The relaxation of targets for Spain has raised hopes in Ireland and Greece that their bailout terms may also be softened.