S&P on Friday revised its outlook from "stable" and affirmed the foreign and local currency ratings on "favourable terms of trade (and) a path toward contained fiscal expenditure".

At 1517 GMT, the rand traded at 15.6500 against the dollar, 1.15% firmer than its previous close.

"The main take-home point from S&P's improved outlook is that it is unlikely that the next rating move will be a downgrade," ETM Analytics said in a research note.

"S&P's upgrade ... could add to the tailwinds provided by the South African Reserve Bank's 50 basis point rate hike last week," it added.

South Africa's central bank on Thursday increased its main lending rate by the largest margin in more than six years, as it stepped up efforts to fight inflation, sending the rand higher.

The price of gold, of which South Africa is a significant exporter, touching a two-week high and a weaker dollar added support to the rand.

On the Johannesburg Stock Exchange (JSE), the All-Share index ended up about 1.2% at 68,367 and the blue-chip index of top-40 companies closed up about 1.3% at 61,788 points, helped by mining and resources companies.

The mining index ended up 3.7%, buoyed by higher gold, silver and platinum prices. Impala Platinum Holdings Ltd, Sibanye Stillwater Ltd and Gold Fields Ltd rose 6.02%, 4.31% and 3.64% respectively.

The government's benchmark 2030 bond also rose, with the yield falling 4 basis points to 9.72%.

(Reporting by Alexander Winning, Rachel Savage and Bhargav Acharya; Editing by Louise Heavens and Bill Berkrot)