The New York-based agency kept Spain's long-term credit rating at "BBB minus", just a notch above junk bond status, but raised the outlook to "stable" from "negative".
Though only a minimal upgrade, the rating action reflected a dramatic change in fortunes in Spain from mid-2012 when it seemed to be tottering on the brink of an all-out sovereign debt bailout.
The decision means Spain can shake off the immediate threat of its long-term debt being downgraded to speculative status, the equivalent of a "junk bond".
A "junk bond" rating implies sharply higher borrowing costs, not least because many institutions such as pension funds are barred from making speculative investments.
"Today's rating action reflects our view that Spain's external position is improving as economic growth gradually resumes," Standard & Poor's said in a statement.
Spain confirmed this week that it had emerged from a two-year recession in the third quarter of 2013, posting feeble 0.1 percent growth.
The Treasury has enjoyed a sharp drop in borrowing costs too, as investors return in search of high returns.
Despite its emergence from recession, Spain's economy faces significant challenges including a 26-percent unemployment rate.
The country is still struggling with the aftermath of a decade-long property bubble that imploded in 2008, throwing millions of people out of work, racking up huge debts for the government, banks and people, and plunging the economy into a double-dip recession.
Prime Minister Mariano Rajoy's conservative government, which took power in December 2011, has enacted economic reforms and austerity policies so as to curb annual deficits and rein in the national debt.
Standard & Poor's said it upgraded the debt look because of its view of Spain's "diversified and prosperous" economy and the government's reform agenda.
But the agency said the Spanish outlook was constrained by high private and public debt, low economic growth prospects from 2013-2016 and "remaining inflexibilities" such as the job market, in which people with indefinite contracts enjoy much stronger protections than those in temporary employment.
The agency predicted Spain's economy would shrink by 1.2 percent this year in real terms before posting growth of 0.8 percent in 2014 and 1.2 percent in 2015 "chiefly on the back of robust exports".
"Strong headwinds persist, however," it warned.
"Domestic demand is weak and constrained by further declines in disposable income due to high unemployment, reduced wages, and budgetary consolidation," Standard & Poor's added.
In addition, investment was subdued as private companies battled to lower debt levels, it said.
Spain's government is forecasting a 1.3-percent economic contraction in 2013 and 0.7-percent growth in 2014, a pace considered by many analysts to be insufficient to lead to net job creation.