Aiden Markram led a stirring South African fightback but could not prevent Australia from closing in on victory on the fourth day of the first Test at Kingsmead on Sunday.

Opening batsman Markram made 143 but South Africa were hanging on at 293 for nine, still 124 runs short of a target of 417, when bad light stopped play.

South Africa were in desperate trouble at 49 for four but Markram shared stands of 87 with Theunis de Bruyn (36) and 147 with Quinton de Kock (81 not out) which gave South Africa hope that they could pull off a miracle victory.

His dismissal, though, opened the door for Australia to rip through the tail. Mitchell Starc took three wickets in five balls to have South Africa nine down.

That caused the umpires to tell Australian captain Steve Smith that play could only continue if he used slow bowlers. De Kock and Morne Morkel survived nine overs in ever-deteriorating light against Smith and Nathan Lyon before the umpires took the players off five minutes before the scheduled close.

That South Africa would even entertain faint hopes of victory seemed impossible when their four most senior batsmen were dismissed without reaching double figures.

But Markram, in only his seventh Test, remained calm amid the carnage. The recovery started with a determined partnership for the fifth wicket with De Bruyn, who made a stylish 36 before he was caught behind off Josh Hazlewood. It was the only wicket to fall between lunch and tea.

A wicket away

Markram was joined by De Kock, whose form leading into the Test had been dismal. But the left-handed wicketkeeper looked in good touch from the start and took the fight to the Australians.

It was Markram’s third Test century but easily his important innings. He made hundreds against Bangladesh and Zimbabwe, two of cricket’s lesser powers, earlier in the season. He showed good composure, a sound technique and some elegant off side drives in a 218-ball innings which included 19 boundaries.

The damage was done before lunch when Dean Elgar, Hashim Amla, AB de Villiers and captain Faf du Plessis all fell cheaply.

Markram and Elgar put on 29 for the first wicket before Elgar edged a sharply lifting delivery from Starc to wicketkeeper Tim Paine to be out for nine.

Amla avoided a pair but only made eight before he was leg before wicket to Hazlewood.

South Africa then suffered a hammer blow when De Villiers, their top scorer in the first innings, was run out for nought.

Markram turned a ball from off-spinner Nathan Lyon behind square leg and did not respond when De Villiers called him through for a run. De Villiers had to turn and tried to go back but could not beat David Warner’s throw to Lyon.

Pat Cummins struck with his third ball of the innings when he beat Du Plessis for pace and flattened his off stump.