Europe’s debt crisis spread its contagion to another country Wednesday when a major agency downgraded Spain’s credit rating, even as Germany grudgingly moved closer to bailing out Greece from imminent collapse.

Greece and Portugal — up to now the focus of alarm — are relative economic minnows. But Spain’s economy, at four times the size of Greece, is considered by many too big to rescue.

At stake is the threat of higher borrowing costs that could crimp government spending for years and undermine the once-mighty euro.

The clock is ticking — Greece has to pay off some $11.3 billion (euro8.5 billion) worth of debt by May 19, but cannot raise the money in the markets given sky-high borrowing costs. The downgrade for Spain was an ominous new blow, coming just as markets were recovering their poise after the double shock Tuesday of a Standard & Poor’s downgrade for Greece — to junk status — and Portugal.

Though Spain’s overall debt burden is fairly modest at around 53 percent of national income — compared to 115 percent for Greece — the country is running a big budget deficit and has done less than others to get a handle on its public finances.