S&P said that despite sluggish growth, the UK's "diversified" economy and "flexible" fiscal and monetary policy would enable it to weather a slowdown.
The news will be welcomed by Chancellor George Osborne, who on Monday told the Conservative Party conference that he would not change economic course.
S&P said its AAA rating could be re-evaluated if the government weakened its resolve to reduce public debt.
An AAA rating is the highest possible. Any downgrade would raise Britain's borrowing costs, and also provide ammunition for the coalition government's opponents.
In an announcement, S&P said it had "affirmed its AAA long-term and A-1+ short-term sovereign credit ratings on the UK. The outlook remains stable."
It said the decision reflected the country's "wealthy and diversified economy, fiscal and monetary policy flexibility, and relatively adaptable product and labour markets".
S&P added: "In addition, we view the UK as having deep capital markets with strong demand for long-dated gilts by domestic institutional investors.
"There is also demand from non-residents for sterling-denominated UK government debt, which provides some diversification to the UK's investor base."