South Africa 347 for 5 (Bavuma 109, Miller 58*) beat England 342 for 7 (Buttler 94*, Brook 80, Moeen 51) by five wickets
Bloemfontein: England's bowlers failed to defend 342 as Temba Bavuma's century helped South Africa to victory in the second ODI to clinch the series 2-0 with one to play.
Jos Buttler's unbeaten 94 off 82 balls had been the backbone of England's total, while Harry Brook made an impressive 80.
But England's attack struggled to make inroads at key moments as South Africa skipper Bavuma's 109 off 102 balls laid the foundation for the chase.
David Miller's unbeaten 58 got the hosts over the line with five balls and five wickets to spare as they completed their third-highest ODI chase.
It could prove to be a crucial victory in the Proteas' bid to secure automatic qualification for the World Cup later this year via the ICC Super League.
Asked to bat first, England recovered from a spell of hostile bowling, which left them 33-2, thanks to crucial knocks by Brook and Buttler.
Moeen Ali played a useful hand with a 45-ball 51 as he shared a 106-run stand with Buttler for the fifth wicket before South Africa's bowlers rallied.
England were pegged back at the business end of the innings, although Buttler and Sam Curran (28) provided an explosive finish, striking 30 off the last two overs.
Bavuma played with freedom en route to his 90-ball century but, having struggled with cramp in the latter part of his innings, was bowled by Curran.
Rassie van der Dussen (38) and Aiden Markram (49) played useful supporting roles, backed up by a composed knock by Miller off 37 balls as he sealed victory with a thumping six off the first ball of final over.