Hashim Amla was forced to retire hurt with a bruised bicep as South Africa battled through the vagaries of an increasingly uneven surface on the fourth morning at Newlands, and ticked off the 41 runs required for a victory that sealed the series against Pakistan.

Their mainstay in 9.5 overs of action was Dean Elgar - no stranger to putting his body on the line in awkward conditions. He did take the precaution of pinching Amla's armguard as his team-mate left the field, but stood firm thereafter, sealing the win with back-to-back boundaries off the part-time seam of Azhar Ali.

Azhar's introduction to the attack with six runs to win was an admission from Pakistan that the game was up, as they instead turned their sights to next week's Johannesburg Test. But up until that point, Mohammads Abbas and Amir had launched a full-blooded defence of their meagre total.

The man who had most to gain - and to lose - in this mini-passage of play was Theunis de Bruyn, who was promoted to open in the place of Aiden Markram, who bruised his thigh in the field, and had an opportunity for a morale-boosting red-inker after an under-productive series.

Instead he was caught behind off an Abbas bouncer for 4, having clipped one sweet boundary off his toes. His place for the Johannesburg Test may depend on Markram's fitness, and indeed that of Amla, who appeared to be left with a dead arm after Amir thudded a vicious lifter into the underside of his bicep as he looked to shoulder arms. Ottis Gibson, South Africa's coach, confirmed after the match that he had suffered bruising but played down any long-term concerns.

Amir's pace and intensity wasn't entirely beneficial to Pakistan's cause, as he served up a quarter of the target in the space of three erratic deliveries, a wild leg-side wide that eluded Sarfraz to fizz to the boundary, and a sizzling bouncer that also flew from a good length, and was called no-ball due to the number of short balls he'd already bowled in the over.

"Definitely, not enough runs in the first innings," said Pakistan's captain, Sarfraz Ahmed, during the post-match presentations. "Maybe closer to 250-300 would have been good. The way our batsmen batted in the second innings showed our courage."

"Our bowlers always enjoy coming here," said Faf du Plessis, South Africa's captain. "And there are runs to be had if you bat properly."

Du Plessis admitted South Africa would have preferred to wrap the match up on the third evening, when Vernon Philander's no-ball prevented them from ending Pakistan's innings with enough time to hunt down the runs.

"We wanted to finish last night, but unfortunately that no-ball happened," he said. Instead it took less than an hour on the fourth day, as South Africa took an unassailable 2-0 lead in the three match series, extending their unbeaten run at home.