Keshav Maharaj became just the second South African to take a hat trick in test cricket and the Proteas were on course for a series victory as West Indies slid to 109-6 at lunch on day four of the second test on Monday.
West Indies was still 215 runs short of its target of 324 and South Africa was in sight of a 2-0 series sweep.
Maharaj's hat trick came in the second-to-last over of the session.
He claimed a big breakthrough when Kieran Powell was caught near the square leg boundary for 51. But the spinner added the wickets of Jason Holder and Joshua Da Silva off his next two balls. Wiaan Mulder took a one-handed catch low down to his right at leg slip to seal the hat trick and send Maharaj running and sliding, soccer-style, on his chest on the grass in celebration.
The only previous South African to take a hat trick in tests was Geoff Griffin against England at Lord's in 1960.
Fast bowler Kagiso Rabada took the first three wickets of the session as West Indies, which started the day 15-0 in its second innings, fell away quickly.
Rabada sent West Indies captain Kraigg Brathwaite (6) and Shai Hope (2) back quickly before forcing a key breakthrough with the wicket of Kyle Mayers for 34, ending his partnership of 64 with Powell.
It came when Mayers tried to be too aggressive against Rabada and sent an attempted pull looping up in the air to be caught by Dean Elgar.
Mayers and Powell appeared to be on course to at least get West Indies to lunch without any further damage but Mayer's fall sparked a collapse of four wickets for 17 runs in the space of five overs.
To make matters worse, West Indies was also missing top-order batsman Roston Chase to a leg injury sustained while fielding, although Chase might still be able to bat later in the innings.