WASHINGTON — The International Monetary Fund said late Friday that Spain’s banks would need to raise at least 37 billion euros, or about $46 billion, as a buffer against a sharper economic contraction in the country. That number will guide European policy makers as they seek to stabilize the Spanish financial system and prevent contagion to the rest of the euro zone.

“The extent and persistence of the economic deterioration may imply further bank losses,” Ceyla Pazarbasioglu, deputy director of the fund’s monetary and capital markets department, said in a statement. “Full implementation of reforms, as well as establishing a credible public backstop, are critical for preserving financial stability going forward.”

The I.M.F. released its banking audit as Spain contemplates making a formal bailout request to Europe to help recapitalize its fragile banking system.

Spanish banks are struggling with significant losses on their housing portfolios, and they have been hurt by the country’s broader economic malaise. Last month, the Spanish government seized Bankia, the country’s biggest mortgage lender. And Spain’s borrowing costs have soared to close to record highs.