South Africa 131 for 1 (de Kock 68, Amla 40*) beat Afghanistan 125 all out (Rashid 35, Tahir 4-29, Morris 3-13) by nine wickets

South Africa have finally won one. So far have the Proteas' stocks fallen in this tournament after three defeats and an unconvincing outing against West Indies, that an Afghan victory in this match was not unthinkable.

But this was a make-or-break encounter for both teams, and it was Afghanistan who blinked - and broke - first, collapsing in a heap after they were unnerved by repeated rain breaks in the afternoon. Having been 39 for 0, Afghanistan's disintegration began in earnest after the second - and longer - of two rain intervals as they lost four wickets in two overs to Imran Tahir's guile and Andile Phehlukwayo's wiles, slipping to 77 for 7.

But for Rashid Khan's boshing, they might have folded for under 100. He cracked a rapid 35 from No. 9 to save some of Afghanistan's blushes before they were bowled out for 125. All told, they had lost 10 for 86, with Tahir collecting 4 for 29 and Chris Morris 3 for 13. Phehlukwayo chimed in with two wickets of his own, and he also performed a crucial holding role, stringing together 36 dot balls as Afghanistan's hit or miss (and today, it was usually miss) tactics backfired.

As has been the case throughout their campaign so far, Afghanistan's batsmen just didn't score enough runs to give their busy, bustling bowling attack enough to work with. Had they managed to scrounge together even 250, there might have been a game on - Quinton de Kock and Hashim Amla were kept to just 35 runs in the Powerplay, and endured some uncomfortable moments early on - but without a total to defend, any intensity remaining in the competition quickly dissipated.

Faced with a chase that even they couldn't muck up, South Africa rode on de Kock's 72-ball 68 to secure a nine-wicket victory - and a vital two points - with slightly more than 21 overs to spare. But while de Kock and Amla's 104-run opening stand settled the result, the match really turned on Tahir's remarkable spin with the ball.

This hasn't been an easy World Cup for Tahir. He had only taken three wickets in four innings before this game, at an inflated average of 44 - easily his worst entry into a World Cup since he debuted at the 2011 tournament in India.

He has also leaked runs, and been strangely reticent about using his googly so far in English conditions. Before this game, just 21% of his deliveries at the World Cup had gone the other way, and none of those had brought him a wicket. But today he threw his trust back into his variations, with devastating effect. His very first ball was a googly, and it snuck between the obdurate Noor Ali Zadran's bat and pad to bowl him for 32 and turn a wobble into an outright collapse.

Moments before, Phehlukwayo had found the edge of Hashratullah Shahidi's bat, Faf du Plessis gobbling up the chance in the slips, as Afghanistan stumbled back into the game after an hour-long hiatus in proceedings while the rain fell. Moments later, Afghanistan were in the midst of a full blown meltdown as four wickets tumbled in the space of 10 balls.

Two balls after Noor Ali was castled, a clueless Asghar Afghan popped back a simple return catch back at Tahir. In the next over, Mohammad Nabi chopped Phehlukwayo onto his own stumps, and soon afterwards Gulbadin Naib slapped a Tahir long-hop to midwicket, where Aiden Markram pulled off a two-handed blinder. For once, Tahir's celebration was not a euphoric solo sprint as he instead charged straight to Markram. All three wickets - even the filthy half-tracker - had come from googlies.

Rashid's hitting then rescued Afghanistan from ignominy. Before he became a globetrotting, batsman-eating, legspinning T20 sensation, Rashid was a batsman in the typically forthright Afghan mode, and he showed glimpses of his early iteration in a death-or-glory cameo from No. 9.

Rashid wore a Rabada stinger on the forearm, but also gave as good as he got, slamming a 90mph delivery handsomely over mid off to raise Afghanistan's 100. He also bruised the figures of his legspinning compadre somewhat in the melee, sweeping and slashing three boundaries in four balls, but Tahir soon won the war. Rashid actually picked Tahir's quicker one, and was aiming to add a six in the same over, but he could only get it as far as Rassie van der Dussen, right on the rope at deep midwicket.

With minimal fuss, Chris Morris returned to mop up the tail, and South Africa's target was a DLS-adjusted 127 from 48 overs. The key battle in the chase - and Afghanistan's last, slim hope - was that between Rashid and South Africa's embattled top order. After Hamid Hassan and Aftab Alam had kept things tight early on, he was introduced as early as the ninth over, but de Kock's immediate response was to sweep his first ball powerfully to deep square leg.

Having set down roots, de Kock took three more boundaries off Rashid - some more convincing than others - and raised his fifty in style in the 17th over, off the 58th ball he faced. With de Kock pushing the game along from the other end, Amla had the space and freedom to spend time at the crease and focus on playing himself back into a bit of form.

Together they took South Africa beyond 100 in the 23rd over - the first century opening stand between the pair since their record-breaking partnership against Bangladesh almost two years ago. As the match got away from Afghanistan, their fielding - never their strongest suit - grew increasingly ragged, and the white flag was raised.

Growing bored of circumspection, de Kock targeted Naib but Nabi pulled off a stunning intercept at midwicket to dismiss him for 68. By then, though, the job was as good as done. South Africa dawdled a little in sealing the deal, but Phehlukwayo - shunted up the order to No. 3 - eventually stepped out to slam Nabi down the ground for the first, and only, six of the day to secure a win and two points.

South Africa might have attacked their total a little more earnestly, with an eye on their net run rate, but their campaign is nevertheless still alive after their first win at the fifth attempt. Afghanistan's hopes of a dream run to the semi-finals have all but ended.

Liam Brickhill is ESPNcricinfo's South Africa correspondent