Even though a buyout of the beleaguered Silicon Valley Bank helped calm investors' nerves, safe haven gold continued to lure investors, while positive demand outlook from China boosted other metals.

"Iron ore has gained from the suggestion of lower inventory levels in China," said Shaun Murison, Senior Market Analyst at IG South Africa.

"Oil imports by China have been forecast to reach record levels in 2023," he added.

Mining stocks, which closed up 2.36%, boosted the Johannesburg Stock Exchange with the index of top-40 companies ending up 0.95% to 70,445 points and the broader all-share index closing up 1.01% to 76,047 points.

The indexes, however, are still at the low levels recorded at the beginning of this year.

The local shares essentially mirrored global sentiment with the MSCI All-World index, which captures equity performances across 23 developed economies, up 0.23%.

At 1536 GMT, the rand, considered a riskier currency, traded at 18.1500 against the dollar, 0.93% stronger than its previous close.

The dollar index, which measures the currency against six rivals, was last trading down 0.311% at 102.430.

The market awaits local economic data expected on Thursday when investors are likely to turn their focus to the central bank's interest rate decision, expecting a 25 basis point hike.

The upbeat sentiment reflected on government bonds with the price of the government's benchmark 2030 bond marginally up and its yield down 3.5 basis points to 9.890%.

(Reporting by Tannur Anders and Bhargav Acharya; Editing by Sherry Jacob-Phillips, Promit Mukherjee and Josie Kao)