The troubled lender Bankia asked the Spanish government for $24 billion in financial support on Friday, the same day that a leading credit-rating agency downgraded the bank to junk status.

Jose Ignacio Goirigolzarri, the bank’s president, said late Friday that the bailout would “reinforce the solvency, liquidity and solidity of the bank.”

The request came as Standard & Poor’s downgraded Bankia and four other Spanish banks to junk status because of uncertainty over restructuring and recapitalization plans.

Trading in Bankia shares was suspended Friday while its board determined how much new aid was needed. The bank’s shares have experienced turbulent trading in recent weeks on fears that it would not be able to cover the massive losses it has built up in bad loans to the country’s collapsed real estate sector.

Spanish banks were heavily exposed to the country’s collapsed real estate bubble and now hold massive amounts of soured investments, such as defaulted mortgage loans and devalued property. Bankia has been the most severely hit, holding $40 billion in such toxic assets.

Bankia was created from the merger of seven regional banks, or cajas, that were deemed too weak to stand alone. But financial concerns continued to plague it — its shares have lost almost half their value since the lender went public in July.

The government decided to intervene this month, effectively nationalizing Bankia and injecting $5.7 billion in aid.

The Spanish government is trying to shore up the banking sector to get credit flowing to the ailing economy. But the cost of rescuing banks could overwhelm government finances, which are strained by a recession and an unemployment rate of nearly 25 percent.

The possibility that the Spanish government might eventually need an international rescue package — like the ones that Greece, Ireland and Portugal have sought — has kept investors on edge for months.

Spanish Prime Minister Mari-ano Rajoy met with Socialist opposition leader Alfredo Perez Rubalcaba late Friday to try to map out a strategy.

The big fear is that if Greece eventually leaves the euro zone, confidence in other financially weak countries such as Spain and Italy could fall, causing the value of their bonds to drop. That would undermine confidence in the system and create bank runs.

Financial experts are increasingly calling for a Europe-wide support system for the banks. “The euro-area financial stability framework needs an urgent overhaul,” said Peter Praet, one of six members of the European Central Bank’s executive committee.

Praet said the euro zone needs a banking regulator operating across borders with the money and authority to restructure banks, as well as a deposit insurance program similar to the U.S. Federal Deposit Insurance Corp.

Asked whether Spain would seek outside help for its banks, Deputy Prime Minister Soraya Saenz de Santamaria, speaking at a weekly government news conference earlier Friday, reiterated the government’s position, saying firmly, “Not at all.”

Spain’s borrowing costs have soared. The yield for key 10-year bonds on the secondary market — an indicator of investor wariness — edged up to a perilously high 6.29 percent by the close of trading Friday. A rate of 7 percent is considered unsustainable over the long term.

Spain’s benchmark IBEX35 stock exchange ended Friday trading up 0.13 percent.

Foreign investors appear to be dumping Spanish government debt. In the first four months of the year, the amount they held fell 24 percent to $267 billion, according to figures released Friday by the Economy Ministry. As of the end of 2011, foreign investors held just over 50 percent of Spain’s debt, but by the end of April that figure dropped to 37.3 percent.

Bankia also announced Friday that it had shaken up its board of directors, reducing it to 10 members from 18.