Captain Faf du Plessis batted almost the entire day for his 103 as South Africa reached 382/6 on Friday to put itself in prime position for a series win over Pakistan.
South Africa went to stumps 205 runs ahead with four wickets in hand after two days of the second Test at Newlands. It has four fast bowlers well-rested and ready to finish off the job when Pakistan bats again to save the game and the series.
South Africa already leads the three-match series 1-0 and another victory will clinch a seventh straight series win at home for the Proteas, who last lost on South African soil to England in 2015-16.
Du Plessis' ninth Test century was completed soon after he had built a 156-run partnership with Temba Bavuma, who made 75 but didn't quite see his skipper to three figures and finally ran out of chances after surviving two near-misses.
Even after Bavuma fell, du Plessis and Quinton de Kock put on another 51 to grind down Pakistan and de Kock, who raced to 50 off 59 balls and was 55 not out at stumps, appeared ready to dish out more on Day 3.
Du Plessis was hit by two painful blows on the fingers and once on the helmet before getting to 100.
Bavuma also batted on after taking some body shots from the Pakistan quicks bowlers on a Cape Town pitch showing signs of occasional unpredictable bounce -- something the South African batters have dealt with and their pace bowlers will relish taking advantage of come Pakistan's second innings.
Pakistan was bowled out for 177 batting first and hasn't reached 200 in any of its three innings so far this series, underlining the challenge to come in its second innings.
Du Plessis arrived at the crease in the second over of the day and left around a half hour before the end. In between, he and Bavuma took the Proteas from a promising position to one of dominance.
Bavuma's first chance came early in his innings when an edge to Azhar Ali at first slip was adjudged by the TV umpire to have been grounded before the fielder scooped it up. He also successfully reviewed an lbw decision when on 65 and moments after being hit a hard blow in the ribs.
Bavuma missed out on a century when edging behind to Shaheen Afridi, but du Plessis didn't as he hit 13 fours and batted through the tough periods for an ideal start to 2019.
Du Plessis also fell caught behind to Afridi, who finished with 3/112, but Pakistan's bowlers didn't have the same success as South Africa's, who tore through the tourists on the first day.
The second day had started well for Pakistan, too, when Mohammad Abbas, back from injury, bowled Hashim Amla with a delivery that jagged back dramatically and knocked the leg stump out of the ground.
South Africa had added only three runs to its overnight score of 123/2, and Amla nothing to his overnight score of 24, when Abbas struck.
Pakistan also removed Theunis de Bruyn for 13 to have South Africa 149/4 before the du Plessis-Bavuma stand. Those two saw out the first session and batted through the entire second session, with their partnership lasting nearly four hours in all and threatening to take the game and the series away.