* Euro zone agrees to lend Spain up to 100 bln euros
* Spain and Eurogroup say bailout will banish any doubts
* Madrid will specify precisely how much after bank audits
* Clash over role of IMF in bailout
By Jan Strupczewski and Julien Toyer
BRUSSELS/MADRID, June 9 (Reuters) - Euro zone finance ministers agreed on Saturday to lend Spain up to 100 billion euros ($125 billion) to shore up its teetering banks and Madrid said it would specify precisely how much it needs once independent audits report in just over a week.
After a 2 1/2-hour conference call of the 17 finance ministers, which several sources described as heated, the Eurogroup and Madrid said the amount of the bailout would be sufficiently large to banish any doubts.
"The loan amount must cover estimated capital requirements with an additional safety margin, estimated as summing up to 100 billion euros in total," a Eurogroup statement said.
Spain said it wanted aid for its banks but would not specify the precise amount until two independent consultancies - Oliver Wyman and Roland Berger - deliver their assessment of the banking sector's capital needs some time before June 21.
"The Spanish government declares its intention to request European financing for the recapitalisation of the Spanish banks that need it," Economy Minister Luis de Guindos said at a news conference in Madrid.
He said the amounts needed would be manageable and that the funds requested would amply cover any needs.
A bailout for Spain's banks, beset by bad debts since a property bubble burst, would make it the fourth country to seek assistance since Europe's debt crisis began.
With the rescue of Greece, Ireland, Portugal and now Spain, the EU and IMF have now committed around 500 billion euros to finance European bailouts.
Washington, which is worried the euro zone crisis could drag the U.S. economy down in an election year, welcomed the announcement.
"These are important for the health of Spain's economy and as concrete steps on the path to financial union, which is vital to the resilience of the euro area," U.S. Treasury Secretary Timothy Geithner said.
Likewise, the Group of Seven developed nations - the United States, Germany, France, Britain, Italy, Japan and Canada - heralded the move as a milestone as the euro zone moves toward tighter financial and budgetary ties.
Officials said there had been a heated debate over the International Monetary Fund's role in Spain's bank rescue, which Madrid wanted kept to a minimum. The IMF will not provide any of the money.
In the end it was agreed that the IMF would help monitor reforms in Spain's banking sector, while EU institutions would ensure Spain stuck to its broader economic commitments.
IMF Managing Director Christine Lagarde said the euro zone's plan was consistent with the IMF's estimate of the capital needs of Spain's banks and should provide "assurance that the financing needs of Spain's banking system will be fully met."
Sources involved in the talks said there had been pressure on Madrid to make a precise request right away, but Spain had resisted.
Euro zone policymakers are eager to shore up Spain's position before June 17 elections in Greece which could push Athens closer to a euro zone exit and unleash a wave of contagion. Spain's auditors could report back after that date.
Nonetheless, analysts said financial markets may be calmed by the announcement when they reopen on Monday.
"The figure of up to 100 billion is more encouraging and pretty realistic; it's an attempt to cap the problem," said Edmund Shing, European head of equity strategy at Barclays.
"The issue, however, is there is still a lack of detail about where the money's coming from, which is crucial. The market will treat it with some caution until they see how it will be funded."
The Eurogroup said the funds could come from either from the euro zone's temporary rescue fund, the EFSF, or the permanent mechanism, the ESM, which is due to start next month. Finland said that if money came from the EFSF, it would want collateral.
EU sources said there was a preference to channel money to Spain through the ESM, rather than the EFSF. Under the ESM, an approval rate of 90 percent or less is needed to trigger aid, and the fund also has more flexibility in how it operates.
"That's why it's so important that the ESM ... be ratified quickly," German Finance Minister Wolfgang Schaeuble said.
The Spanish government has already spent 15 billion euros bailing out small regional savings banks that lent recklessly to property developers. Spain's biggest failed bank, Bankia , will cost 23.5 billion euros to rescue and its shareholders have been wiped out.
"Whatever the formula being used, we need to say two things: first the innocent should not suffer for the guilty, second public money should come back to public coffers," said Socialist opposition chief Alfredo Perez Rubalcaba after speaking with Prime Minister Mariano Rajoy on Saturday morning.
The race to resolve the banks' troubles comes after Fitch Ratings cut Madrid's sovereign credit rating by three notches to BBB, highlighting the Spanish banking sector's exposure to bad property loans and to contagion from Greece's debt crisis.
It said the cost to the Spanish state of recapitalising banks stricken by the bursting of a real estate bubble, recession and mass unemployment could be between 60-100 billion euros ($75-$125 billion).
Italy could yet get dragged in too. Its industry minister, Corrado Passera, said the economic situation in Italy had improved since the end of 2011, but remained critical.
"Europe was more disappointing than we had expected, it was less capable of tackling a relatively minor problem such as Greece," Passera told a conference on Saturday.
While Spain would join Greece, Ireland and Portugal in receiving a European financial rescue, officials said the aid would be focused only on its banking sector, without taking the Spanish state out of credit markets.
That would be crucial to avoid overstraining the euro zone's rescue funds, which would struggle to cover Spanish government borrowing needs for the next three years plus possible additional assistance for Portugal and Ireland.
Conditions in the plan did not appear to add to the austerity measures and structural economic reforms which Rajoy's government has already put in place.
"Since the funds being asked for are to attend to financial sector needs, the conditionality, as agreed in the Eurogroup meeting, will be specifically for the financial sector," de Guindos said.
EU and German officials have cited national pride in the euro zone's fourth largest economy as a barrier to requesting a full assistance programme.
The European Commission and Germany both agreed in principle last week that Spain should be given an extra year to bring its budget deficit down below the EU limit of 3 percent of gross domestic product because of a deep recession.
The Eurogroup also said money could be funnelled to Spain's FROB bank fund although the government would "retain the full responsibility of the financial assistance".
Irish Finance Minister Michael Noonan said the funds would be provided through the EFSF or ESM at the same interest rates that apply to funds provided to other bailout countries.