Dean Elgar and Hashim Amla struck half-centuries as South Africa beat Pakistan by six wickets inside three days in the first Test at SuperSport Park on Friday.
The pair survived some early scares and put on 119 for the second wicket before Elgar was caught behind off part-time medium-pacer Shan Masood for 50, one ball after reaching his half-century.
Amla finished a year in which he seldom found top form by making 63 not out.
The value of the partnership between Elgar and Amla was highlighted as Theunis de Bruyn and captain Faf du Plessis both fell cheaply before Temba Bavuma swept Yasir Shah for four to take South Africa past their small target of 149.
Both captains, Du Plessis and Pakistan's Sarfraz Ahmed, made 'pairs' by being dismissed without scoring in both innings.
Pakistan made an ideal start when Hasan Ali trapped Aiden Markram leg before wicket before a run had been scored.
Hasan and Mohammad Amir did not concede a run off the bat until Amla clipped Hasan for four in the sixth over.
There were two crucial incidents with the total on 16, either of which could have swung the game in Pakistan's favour.
Amla, on eight, was dropped by Fakhar Zaman at third slip off Hasan when he slashed hard at the ball, which flew at chest height to the fielder. In the next over, Elgar, on four, edged new bowler Shaheen Shah Afridi low to first slip where Azhar Ali appeared to take a diving catch.
On-field umpires Bruce Oxenford and Sundaram Ravi conferred before referring to television umpire Joel Wilson with a 'soft' signal of out, indicating they thought it was a clean catch.
After looking at several replays, including super-slow close-ups, Wilson ruled the ball had bounced and Elgar was reprieved.
The decision clearly astonished the Pakistan players and coach Mickey Arthur was seen leaving his place on the players' balcony and going to the adjacent office of match referee David Boon.
Television commentator Michael Holding criticised his fellow West Indian Wilson.
"I'm convinced he was out," said Holding. "I think the third umpire made a mistake. The protocol says you have got to be 100 percent sure the decision was wrong to change it."
Elgar and Amla survived some testing bowling from the Pakistan seamers and gradually began to lift the scoring rate on a pitch which favoured bowlers throughout.
South African fast bowler Duanne Olivier was named man of the match for his match return of 11-96.
The second Test begins in Cape Town on January 3.