Madrid - Responding to increasingly urgent calls from across Europe and the United States, Spain on Saturday agreed to accept a bailout for its cash-starved banks as European finance ministers offered an aid package of up to $125 billion.
European leaders hope the promise of such a large package, made in an emergency conference call with Spain, will quell rising financial turmoil ahead of elections in Greece that they fear could further shake world markets.
The decision made Spain the fourth and largest European country to agree to accept emergency assistance as part of the continuing debt crisis. The aid offered by countries that use the euro was nearly three times the $46 billion in extra capital the International Monetary Fund said was the minimum that the wobbly Spanish banking sector needed to guard against a deepening of the country's economic crisis.
The announcement of a deal came amid growing fears that instability in Spain could drag down an already sputtering world economy. The decision was the culmination of weeks of a contentious back-and-forth between Spain and its would-be creditors in which it was hard to tell how much of Spain's resistance to financial help was tactical maneuvering for a better deal and how much a refusal to admit the depth of the banking sector's troubles.
The escalating tension prompted President Obama to push Friday, in unusually explicit terms, for quick European action.
European officials have said they wanted their offer to go well beyond Spain's immediate needs to shield the country from any destabilizing effect from next weekend's Greek parliamentary election. Spain has fought to avoid the stigma of a bailout and on Saturday portrayed the Europeans' offer as coming with few strings attached. Although the European statement on the aid package gave few details, it did not mention new austerity measures and said the conditions of the agreement were focused instead on banking reforms, as Spain had requested.
Spanish officials on Saturday denied that their country was in the same position as Greece, Portugal and Ireland, which have all received bailouts that demanded they slash spending.
"What we are asking is financial support, and this has absolutely nothing to do with a full bailout," Luis de Guindos, the Spanish economy minister, said at a news conference in Madrid announcing the request, saying the assistance "allows us to have an ample safety margin" and "will return trust and confidence to the euro project."
The deal to shore up Spain's banks is only the latest in a marathon crisis that has seen one stopgap solution after another over the last three years. The 11th-hour fixes have always given way to new speculation about the long-term solidity of the currency union, and European leaders remain deeply divided about the way to carry out a more lasting solution. Ahead of a summit meeting this month, members of the euro zone are debating a variety of fixes related to forming a tighter political and fiscal union.
The amount of the financing package is expected to be completed after two consulting firms publish their audit reports on Spanish banks on June 21.
The maximum figure of $125 billion was intended to cover the "estimated capital requirements with an additional safety margin," according to the statement issued by euro zone finance ministers. The statement also said that the euro group "supports the efforts of the Spanish authorities to resolutely address the restructuring of its financial sector."
Christine Lagarde, the managing director of the I.M.F., said the scale of the proposed financing "gives assurance that the financing needs of Spain's banking system will be fully met." And the United States Treasury secretary, Timothy F. Geithner, called the support European partners were showing Spain "important for the health of Spain's economy." He said that Spain's request for aid and Europe's agreement were "concrete steps on the path to financial union, which is vital to the resilience of the euro area."
"It's a calming signal at a time when calming signals are badly needed," said Jens Boysen-Hogrefe, an economist at the Kiel Institute for the World Economy. But Mr. Boysen-Hogrefe said it did not solve the underlying problems of Spain or the euro area as a whole. "The uncertainty is still high and bad news can pop up anywhere in the euro area. This is not a final solution."
Many financial analysts expect the Greek elections next week to spook the already unsettled markets and test the very cohesion of the euro zone.
Before Saturday, Prime Minister Mariano Rajoy of Spain had tried to hold out against the withering pressure of capital markets, which drove up Spain's borrowing costs, and the lobbying of European leaders, led by Chancellor Angela Merkel of Germany, to come up with a plan to recapitalize the banks hit worst by the bursting of Spain's property bubble. Mr. Rajoy wanted the rules changed, or at least bent, so the money went directly to the banks and Spain could claim more convincingly it had not received a bailout.
The money, however, will be channeled through the Spanish bank-bailout fund, and the Spanish government will ultimately be responsible and will have to sign the memorandum of understanding and the conditions that come with it.
Still, Mr. de Guindos said that, based on his discussions with euro zone ministers, he expected the terms of the emergency loan to be "very favorable." He noted that not all of Spain's banks would need help, adding that "the problem that we face affects about 30 percent of the Spanish banking system."
European leaders have underscored previously, and reiterated in their statement on Saturday, that Spain had made significant budget cuts and labor market reforms. Germany's finance minister, Wolfgang Schäuble, praised the steps undertaken thus far, calling the teleconference "constructive" and saying in a statement that "Spain is on the right path and Germany, just like the other countries and institutions of the euro zone, as well as probably the I.M.F., will support Spain on that way."
Robert Tornabell, a banking professor at the Esade business school in Barcelona, said that despite the government's insistence to the contrary, "What has just been agreed is in fact a bailout, just like what had to be done for Ireland because of its banking problems."
He said Spain's rescue request would "clearly hurt" the credibility of the government of Mr. Rajoy, as well as that of the Bank of Spain, following their repeated claims that Spain would not require European emergency funding in order to keep its banking sector afloat. Still, Mr. Tornabell said, "This is good news for our banking system, as is the fact that the euro group is not imposing such strict conditions and seems willing to offer Spain an interest rate well below that of the market."
The real test will begin when financial markets reopen Monday and, in particular, when Spain tries to borrow money again from private lenders. The country's borrowing costs have been pushed to close to record highs in part because of the problems at its banks, which are struggling under the weight not only of significant losses in their real estate loan portfolios, but also the country's broader economic malaise.
By resisting harsh bailout conditions, Mr. Rajoy was hoping to escape Greece's fate. Tough conditions there have caused political upheaval, with the left-wing party led by Alexis Tsipras vowing that if it comes to power, it will refuse to live up to the nation's bailout terms.
European officials hope an infusion of cash for Spain's banks will strip some uncertainty from the markets, which will be agitated enough if Mr. Tsipras's party wins.
Raphael Minder reported from Madrid, Nicholas Kulish from Berlin, and Paul Geitner from Brussels. Annie Lowrey contributed reporting from Washington.