By Sam Drury
India needed just a day and a half and 642 balls to beat South Africa by seven wickets in the shortest Test to produce a winner in the history of the game.
Set 79 to win, the tourists got over the line midway through the afternoon session on day two at Newlands to conclude a remarkable match.
South Africa were bowled out for 55 on day one and, despite Aiden Markram's superb 106, they were all out again for 176 by the end of the second morning.
India's win means the series ends 1-1.
The previous shortest Test also involved South Africa, who were beaten by Australia in 656 balls in Melbourne in 1932.
After 23 wickets fell on a chaotic first day in Cape Town, India picked up where they left off with Jasprit Bumrah removing South Africa right-hander David Bedingham in the first over of day two.
It was the first of five wickets in the session for Bumrah, who finished with figures of 6-61, as the hosts collapsed again on a bouncy, lively surface.
The lone resistance came from the impressive Markram as he countered superbly to bring up his seventh Test century from 99 balls.
He eventually fell to Mohammed Siraj with South Africa bowled out for 176 soon after.
India's chase began after lunch and they were intent on finishing the job quickly with left-hander Yashasvi Jaiswal playing in T20 mode at the top of the order.
The tourists were more than halfway to their target by the time he holed out off Nandre Burger for 28.
Although Shubman Gill and Virat Kohli were dismissed as India closed in, Shreyas Iyer thumped the last ball of the 12th over for four to seal a memorable win.
It is a disappointing end for South Africa captain Dean Elgar, for whom this was an 86th and final Test before retirement.
However, the Proteas' victory in the Boxing Day Test at Centurion ensures that India have still never won a Test series in South Africa.
Shortest Tests to produce a winner
- South Africa v India, Cape Town, January 2024 - 642 balls
- Australia v South Africa, Melbourne, February 1932 - 656 balls
- West Indies v England, Bridgetown, January 1935 - 672 balls
- England v Australia, Old Trafford, August 1888 - 788 balls
- England v Australia, Lord's, July 1888 - 792 balls
- This story was first published by the BBC