MADRID (MarketWatch) -- Unlike a couple of weeks ago when Spain was basking in the glow of a World Cup soccer victory, Friday's bank stress tests were a more sobering affair with five of the savings banks here failing.

Of the 91 financial institutions tested by the Committee of European Banking Supervisors (CEBS) in the European Union, nearly one third were Spanish. Particular attention was focused on the country's savings banks, known as cajas, which have been hard hit by bad bets on the collapsed construction and property market.

Germany's Hypo Real Estate and Greece's ATE Bank were the only non-Spanish banks that failed the test, which was given to 91 banks in the European Union.

While the big banks largely held by U.S. investors, including Banco Santander SAN, +0.54% (SAN) and BBVA BBVA, +1.48% (BBVA) sailed through the stress tests as expected, four savings banks will require €1.84 billion in additional funding to keep Tier 1 ratios above 6% in the worst-case scenario. The fifth failed bank, Cajasur, which made the headlines last May, has already been taken over, but was counted among those that failed.

Still, the Bank of Spain was upbeat, saying the tests show "the Spanish banking system is sound" and the tests substantiate the savings bank restructuring and recapitalization plan the central bank has been pursuing over the past 12 months.

Spain's finance minister, Elena Salgades, said in a press conference that 95 of the country's banks were tested. "The tests show Spain has a solid (banking) system with robust entities, which are able to withstand adverse situations.

The key to determining which of the 91 banks failed the test -- and would need to raise capital -- was whether Tier 1 capital ratio could be kept above 6% under the loss assumptions imposed by the test, a so-called adverse scenario as of Dec. 31, 2011.

Banco Santander's reported Tier 1 ratio was 10% as of Dec. 31, 2009 and under the adverse scenario rose to 10.2%. Even in the adverse scenario and adding a shock to the sovereign debt markets, Tier 1 stays at 10%. Much of its ability to keep that Tier 1 high is down to the bank's ability to keep earning more than it loses. Two years after the adverse scenario, two-year cumulative pre-impairment income is projected at €45.74 billion, against losses of some €28 million.

Tier one for BBVA, meanwhile, was 9.4% at end 2009, which edges up to 9.6% under the adverse scenario. Two years after the adverse scenario, BBVA would have pre-impairment income of €21.77 billion, against losses of around €12 billion. The worst scenario, adding sovereign risk, brings that Tier 1 down to 9.3%.

Both banks have persistently maintained their books are sound and analysts believe both, especially BBVA, have enough international business to protect them from the Spanish downturn. Santander said earnings would decline, though, under the most negative scenario.

Data was released from the Bank of Spain, the Association of Spanish Banks (AEB) and Cajas de Ahorros, the organization in charge of Spain's cajas, or savings banks.

The smaller domestic banks tested included Banco Popular Espanol (POP), Banco de Sabadell (SAB), Bankinter (BKT) and Banco Espanol de Credit (BTO).

Savings banks under pressure

Of the country's 45 savings banks, 39 are in the process of mergers and will receive around €10.19 billion in public funds to help those mergers along. Many were treated as already merged entities under the guidelines of the stress tests. Those the

Those failed banks include several mergers:

(UNNIM) Caixa Destalvis de Sabadell, Caixa Destalvis de Terrassa and Caixa Destalvis Comarcal de Manlleu (DIADA) Caixa Destalvis de Catalunya, Caixa Destalvis de Tarragona, Caixa Destalvis de Manresa (ESPIGA) Caja de Ahorros de Salamanca y Soria (Caja Deuro); Caja de Espana de Inversiones, Caja de Ahorros y Monte de Piedad (Caja Espana) (BANCA CIVICA) Caja de Ahorros y M.P. de Navarra, Caja de Ahorros Municipal de Burgos y Caja General de Ahorros de Canarias.

Cajasur was the fifth to fail the stress tests. While these unlisted savings banks don't come under strict analyst scrutiny, Cajasur's demise in May triggered a decline in stock markets after the Bank of Spain seized the Catholic church-run savings bank. The takeover also put a focus on Spain's troubled economy and banks.

The Bank of Spain has also taken over Caja Castilla-La Mancha. Spain has €12 billion set aside in its bailout fund for the cajas.

Spain's savings banks have endured a difficult time since the country's housing and construction market have collapsed. Barbara Kollmeyer/MarketWatch

Earlier this month, the government approved reforms to bolster those institutions by curbing political interference, restricting the number of elected public officials allowed on their management and supervisory boards. The reforms also opened up the cajas to private investors, allowing them to sell shares known as "cuotas participativas" with voting rights that give an investor as much as 50% control.

Spain's IBEX-35 (IBEX) closed up 0.8% to 10,388.20 ahead of the stress tests, with shares of Spain's big international and smaller domestic banks trading mostly range-bound throughout the day. Santander closed up 1.7% and BBVA closed up 1.3% as optimism leaked into the markets that most Spanish institutions would be fine under the tests.

The Bank of Portugal said its four banks tested, Caixa Geral de Depositos, Banco Comercial Portugues (BCP) (BCP), Espirito Santo Financial Group (ESF), Banco BPI (BPI) and Caixa Geral de Depositos, all passed the stress tests.