The Spanish government has tried to keep unemployment down
Spain has had its credit outlook cut to negative from stable by the ratings agency Standard & Poor's.
The agency said Spain faced a deeper deterioration in public finances and a longer period of economic weakness than it had previously expected.
The news rattled European markets, which were already unsettled by Tuesday's decision by another ratings agency, Fitch, to downgrade Greece.
Stock markets in London, Paris and Frankfurt all closed lower.
"Reducing Spain's sizable fiscal and economic imbalances requires strong policy actions, which have not yet materialised," Standard & Poor's said in a statement.
Spain is still in recession and the government has launched a massive public works programme to try to keep unemployment under 20%.
"We don't agree with this decision," a spokesman for the Spanish economy ministry said of S&P's move.
Spain's debt is expected to hit 67% of gross domestic product next year, according to S&P, compared with 125% forecast for Greece.
Meanwhile, the Greek prime minister has promised to shore up the country's public finances.
"Either we eradicate the debt or the debt will eliminate the country," George Papandreou said, copying a phrase first used by his father Andreas, who also served two terms as prime minister.