Hasan Ali took three wickets as Pakistan completed a stunning turnaround in the field to restrict South Africa to 219 for eight in their Champions Trophy Group B match at Edgbaston on Wednesday before winning the match by 19 runs.

Pakistan had managed 119/3 in 27 overs before rain washed out play and forced a result under the Duckworth-Lewis method. Pakistan had needed 101 runs at that stage to take them over the finishing line as winners.

Debutant Fakhar Zaman and Babar Azam were the top scorers for the Pakistan side, each contributing 31 runs apiece. Mohammad Hafeez scored 26 off 53 balls to round off the top three.

Just three days after conceding 319 for three against arch-rivals India in a crushing 124-run opening defeat by the title-holders at Edgbaston, Pakistan were a transformed side on their return to the Birmingham ground.

Their spinners did the initial damage as South Africa slumped to 61 for three before paceman Hasan, striking twice in two balls, followed up on his way to figures of three for 24 in eight overs.

South Africa were indebted to David Miller’s 75 not out after their top-order slump.

Miller received good support from Chris Morris (28) and Kagiso Rabada (26) in seventh and eight-wicket stands of 47 and 48 respectively.

Such was Pakistan’s command in the field, they inflicted the first golden duck in the 221-match one-day international career of South Africa captain AB de Villiers.

Given totals of 300 are now generally regarded as ‘par’ in ODI cricket, Pakistan were clearly on top at the innings break.

However, the way they collapsed to 164 all out against India meant the Proteas were still in this game. South Africa came into Wednesday’s match as firm favourites.

Not only are they top of the ODI rakings compared to Pakistan’s eighth, but they beat Sri Lanka by 96 runs in their tournament opener at the Oval last week.

But none of that counted for very much after de Villiers won the toss in this day/night fixture.

Mohammad Amir and Junaid Khan, in for the injured Wahab Riaz, formed an all left-arm new-ball attack.

Read: ‘Tried my best, wasn’t good enough’: Wahab apologises for dismal Pak-Ind Champions Trophy performance

But it was the spin duo of Imad Wasim and Mohammad Hafeez who did the early damage.

Left-armer Imad struck second ball when Hasim Amla (16), going across his stumps, was lbw. Off-spinner Hafeez then had Quinton de Kock (33) lbw on the sweep.

The two spinners combined when de Villiers departed first ball by slicing Imad to Hafeez at backward point.

Hasan, as Imad had done, struck second ball when Faf du Plessis (26) played on. Left-hander Miller twice drove Hafeez for sixes over long-on.

But Hasan took two wickets in two balls to reduce South Africa to 118 for six in the 29th over with a couple of brilliant deliveries from around the wicket.

The first straightened to find the outside edge of JP Duminy, well caught by diving slip Babar Azam, while the next, on a similar line, knocked over Wayne Parnell’s off-stump to raucous cheers from the large Pakistan contingent in the crowd.

Miller survived the hat-trick at the start of Hasan’s next over.

On 47 he was given out lbw to Amir but successfully reviewed the decision.

Junaid then bowled Morris (22) only to be denied by a no-ball call.

Miller brought up the 200 by driving Junaid for six and ended the innings by hitting Hasan for four, one of just nine South Africa managed in total.

That was Miller’s lone four in a 104-ball innings that also included three sixes.