South African stocks rallied on Friday after stumbling in the previous session, with the Gold Mining Index leaping over 5 percent as bullion’s spot price raced to three-month highs above $1,300 an ounce.

Gold Fields lead the rush into producers of the precious metal, soaring 8.5 percent higher to 44.42 rand after losing over 5 percent in the previous session after it announced a $672 million write-down and delays in its South Deep mine project – a fall some analysts had said was overdone.

Other mining companies also gained, with Impala Platinum adding 2.60 percent to 123.90 rand despite a three-week strike over wages against it and rivals Anglo American Platinum and Lonmin that shows no signs of ending.

Domestic mining gains came in the face of a one percent gain in the rand currency, which is often negative for local resource companies which sell their commodities in dollars.

But the rising gold price and a weaker dollar also point to investor appetite in riskier assets rising, which could bring Johannesburg stocks back to life highs.

The Top-40 index ended 0.87 percent higher at 41,482.39, less than 1,200 points shy of its record peak scaled last month.

The All-share closed 0.82 percent higher at 46,628.74, also within striking distance of its all-time high.

“If you look at the commodities they are quite strong, across the board, despite the strong rand,” said Abri du Plessis, chief investment officer at Gryphon Asset Management.

“But breweries and Richemont are weak, and these are so-called defensive stocks. It is indicating there is a risk-on trade and in that environment new highs can easily be reached,” he said.

Johannesburg-listed shares of luxury-goods maker Richemont lost 0.68 percent to 108.63 rand while South African Breweries shed 0.37 percent, among the few losers on the Top-40 index.

Advancers outnumbered decliners 168 to 129, according to preliminary bourse data, with around 168 million shares changing hands.