Afghanistan won the second ODI by 177 runs to take an unbeatable 2-0 lead in the three-match series in Sharjah.
South Africa completed victory inside three days after bowling West Indies out for 222, having set them a target of 263 to win the match.
South Africa have rested batter Temba Bavuma for their home white-ball series against India this month after a poor Cricket World Cup, but he will captain the team in the two-Test series which starts on Dec. 26.
Bavuma scored 86 runs before falling leg before wicket to an away swinging full toss from Jayden Seales while opener Tony de Zorzi contributed 76.
The 30-year-old De Kock, who has already retired from Test cricket, confirmed he will not play One-Day Internationals beyond the World Cup.
South Africa is one of the most challenging places in the world for batters and the side which can adapt to the seamer friendly conditions quickest has the best chance of success in the first Test against India, according to home captain Temba Bavuma.
South Africa captain Temba Bavuma's participation in the on-going first Test against India was thrown into jeopardy after he limped off the field with a left hamstring strain in Centurion on Tuesday.
South Africa captain Temba Bavuma wanted a clinical performance from his bowlers after posting the highest total in World Cup history of 428/5 against Sri Lanka in their tournament-opener, adding that he was satisfied with individual achievements of his players.
Rohit Sharma closes in on Babar Azam at the top of the ODI rankings for batters
They have looked more comfortable setting targets than chasing one though, and they will expect more penetration from their bowlers against a resurgent Australia.
Alick Athanaze fell agonisingly short of a maiden Test century but still did enough to help ensure a draw in the first Test against South Africa.
Bavuma has replaced Dean Elgar as skipper in the longest format, though the latter remains part of a much-changed squad.
South Africa will look to fix their chasing troubles before the semifinals while Afghanistan will back themselves to beat another top team
South Africa meet India in Centurion in the opening Test starting on December 26 before moving to Cape Town for the second match from January 3.
South African pacer Kagiso Rabada and Test captain Temba Bavuma, who are not part of the Proteas white-ball cricket mix to gear up for the Test series against India, won't feature in domestic cricket.
South Africa host Australia for three T20 matches from August 30 to September 3 and five ODIs from September 7 to 17.
South Africa is set for a fairytale farewell as Dean Elgar takes the helm in the final Test against India
Injury-hit Sri Lanka and South Africa seek winning start to World Cup
The Netherlands caused a stunning upset by beating South Africa by 38 runs in a rain-shortened match.
Images from the ICC World Cup match between Afghanistan vs South Africa, in Ahmedabad, on Friday.
Temba Bavuma has recovered from injury and will take charge
It is a second Test century for middle-order batter Bavuma in his 56th match
South Africa pacer Kagiso Rabada believes Proteas have all the strength to shake the 'chokers' tag and get their hands on the coveted ICC Men's Cricket World Cup trophy for the first time.
Quinton de Kock will retire from One-Day Internationals after the 50-overs World Cup in India.
The bowling stocks looks good, but the major concern will be around the batting line-up, which struggled on the recent tour of England.
World No 1 India may feel they have never had a better chance of winning their first ever Test series in South Africa.
It was a starry affair at the Narendra Modi stadium as the skippers of all ten World Cup teams attended the captain's day.
Images from the second semifinal between Australia and South Africa in the ongoing ICC Men's ODI World Cup at the Eden Gardens on Thursday.
Images from the World Cup 2023 match between Australia and South Africa.
Despite winning his first Test as captain, Temba Bavuma will walk away with mixed emotions after registering an unwanted record against his name.
'The last time we were here, we were tested and challenged in all departments of our game and I think we replied to it quite well. So I expect a good, strong and competitive series.'
Star batter Virat Kohli was covering the swing well although he played and missed often until one ball moved away late to send him back to the dressing room, a pleased as punch Kagiso Rabada said after getting his 14th five-wicket haul in Test cricket.
The victory moved South Africa, who picked up 10 points, into ninth place in the World Cup Super League which determines the eight automatic qualifiers for the World Cup in India later this year.
Bangladesh might not look too threatening in the World Cup but their record against the Proteas
'The next game is obviously a big one for us against the Netherlands in Adelaide. Have to put this one behind quickly, take whatever learnings we can.'
Australia bowled out South Africa for a below-par 212 despite David Miller's defiant 101 but the chase was not as straightforward as Pat Cummins and his team would have liked.
Australian team will be aiming to put up a much better batting performance with a rejigged playing eleven against an upbeat South Africa
Jacques Kallis remarked that the Proteas players should stick to their roles during the ICC Cricket World Cup in India
South Africa won their T20 series against world champions West Indies and Ireland, and will once again be captained by Temba Bavuma in both formats.
South Africa should have been more clinical in the run-chase against Pakistan during the World Cup match in Chennai on Friday, said skipper Temba Bavuma, adding they were lucky to escape by the skin of their teeth.