A century by AB de Villiers and two early strikes by the bowlers gave South Africa the edge on the third day of the third and final Test against the West Indies at Newlands on Sunday.
De Villiers was last man out for 148 as South Africa were bowled out for 421, a lead of 92.
South Africa then dismissed both West Indian openers before Leon Johnson and Marlon Samuels took the tourists to 88 for two at the close, four runs behind.
De Villiers started the day with an array of attacking strokes, but he was forced to change gears when captain Hashim Amla was caught behind and Temba Bavuma followed soon after the second new ball was taken.
He accelerated again on either side of lunch as South Africa moved closer and then passed the West Indian total and reached his hundred with his third audacious reverse sweep in an over from off-spinner Marlon Samuels which yielded 14 runs.
His 21st Test century - and his sixth against the West Indies - was made off 144 balls with 11 fours.
As he ran out of partners, with two men run out, he hit a six off Samuels before being caught at wide long-on attempting to clear the boundary again. His innings lasted for 194 balls and he hit 15 fours and a six.
De Villiers was involved in two significant partnerships, 97 for the fourth wicket with captain Hashim Amla, who made 63, and 96 for the sixth wicket with Stiaan van Zyl (33).
Amla was dismissed by the first delivery sent down after a ball change in the 76th over, with Jason Holder getting extra bounce with the replacement ball to have Amla caught behind.
It was a day of toil for the West Indian bowlers in front of a capacity crowd but they bowled with discipline and kept the scoring under control for the most part with defensive field placing.
Holder and Samuels took two wickets each, while there were three run-outs, two of them direct hits by Jermaine Blackwood and Leon Johnson.
As they had in the first innings, West Indian opening batsmen Kraigg Brathwaite and Devon Smith saw off the first spells of Dale Steyn and Vernon Philander.
But the tall Morne Morkel produced a breakthrough in his first over when Smith gloved a legside catch to wicketkeeper De Villiers.
Off-spinner Simon Harmer also struck in his first over, bowling Brathwaite with a ball which turned back sharply as the batsman went back on his stumps, reducing the West Indies to 27 for two.
Brathwaite survived a chance three balls earlier when De Villiers could not hold a sharp edge off the spinner.
Samuels and Johnson survived to the close, adding an unbeaten 61 for the third wicket.
Samuels gave a difficult chance when he had 13, clipping Steyn to mid-on where Morkel dived full length to his right but could not hold on.