South Africa have claimed their first win in the ODI series with England after Quinton de Kock and Hashim Amla's partnership of 239 powered the hosts to a seven-wicket victory in Centurion.
The visitors - first up to bat - were not without their moments of note on their way to 318-8 from their 50 overs, with Joe Root claiming his seventh ODI century after strong partnerships with Alex Hales and Ben Stokes.
The Yorkshireman was eventually out for 125 runs off 113 balls, a career-best, while Stokes smashed 53 from just 37 and Hales contributed 65 to put England in the driving seat as 300 approached.
However, four wickets for just 22 runs as the balls began to run out - including just three each from Moeen Ali and Chris Jordan - left the match finely poised as the South Africans began the chase.
Root soon found himself upstaged as De Kock put in the stand of the day with 135 from 117 balls, including 16 fours and four sixes, during a devastating partnership with Amla, whose 127 earned him his 22nd ODI century.
David Wiese was the only other wicket to fall with a relatively tame seven as Faf du Plessis (33*) and AB de Villiers (0*) carried the Proteas over the line with 22 balls remaining.
England lead the series 2-1 with two matches still to play.