The New York-based credit rating agency confirmed Spain's long-term debt at "BBB minus", just a single notch above junk bond status.
Junk bonds are a higher risk investment for buyers as they are more likely to default, but payouts are higher as a result.
The rating for Spain's bonds was given a negative outlook, meaning it could be lowered to junk bond status in the next 12–18 months if Spanish economic reforms falter, eurozone support fails to satisfy investors or government debt runs out of control.
Spain's economy will shrink by 1.5 percent this year before enjoying 0.6-percent growth in 2014 as the recovery is crimped by high unemployment, low wages and a budget squeeze, Standard & Poor's said in a statement.
"Positively, we believe that the Spanish economy is recalibrating," the agency said.
"The focus appears to be moving toward external demand as strong goods and services exports have shown since 2010," the agency said.
Spain's competitiveness had also improved, it said, with labour costs sliding by 10 percent since mid-2009.
But external debt posed a risk, it said, with net international liabilities hovering just below 100 percent of annual economic output.
The high cost of borrowing for the private sector slowed the economy, too, it said.
The jobs outlook remained grim in Spain, where the unemployment rate shot above 27 percent in the first quarter of 2013.
"Despite the robust export performance we expect unemployment to remain very high at above 26 percent at least until there is a sustained economic recovery," Standard & Poor's said.
Weak investment in Spain, where firms face high borrowing costs, and demographic changes such as Spain's ageing population, were undermining the country's medium-term growth potential, it said.
The agency said it expected Spain to meet targets agreed with the European Union of cutting the public deficit to 6.5 percent of gross domestic product in 2013 and 5.8 percent in 2014, but extra austerity measures may be needed.
Prime Minister Mariano Rajoy's government could find more savings by reducing tax exemptions, squeezing public salary end-of-year salary payments or changing the social security system, including pensions, it said.
Spain's deficit-cutting targets for the following two years – 4.2 percent of GDP in 2015 and 2.8 percent in 2016 – were at risk, however, from the weak economic prospects and political temptations to spend in a likely election year in 2015, Standard & Poor's said.