Pakistan 185 for 9 (Shadab 52, Iftikhar 51, Nortje 4-41) beat South Africa 108 for 9 in 14 overs (Bavuma 36, Afridi 3-14, Shadab 2-16) by 33 runs (DLS method)
Sydney: Pakistan boosted their slim hopes of progressing in the Men's T20 World Cup with a brilliantly frenetic win against South Africa at the Sydney Cricket Ground.
Pakistan launched a recovery from 48-4 to post 185-9 and then took regular wickets to deny South Africa in a chase shortened by rain to win by 33 runs on the Duckworth-Lewis-Stern method.
The result means Pakistan can still qualify for the semi-finals but need to beat Bangladesh on Sunday and hope South Africa fail to beat the Netherlands or India lose to Zimbabwe.
They are indebted to Shadab Khan and Iftikhar Ahmed, who combined for a wild partnership of 82 from 35 balls.
Shadab smashed 52 from 22 balls and Iftikhar a 35-ball 51 in an infectious display of hitting, to the delight of a raucous, Pakistan-dominated crowd.
Then, after Temba Bavuma and Aiden Markram put on 49 in 27 balls to give South Africa hope, leg-spinner Shadab removed both within three deliveries.
Rain arrived soon after, with the target reduced to 142 off 14 overs, South Africa needing 73 off 30 balls from 69-4.
Heinrich Klaasen hinted at an improbable Proteas win by striking three fours in his first four balls after the restart but his dismissal, caught off Shaheen Afridi, allowed Pakistan to clinically close out the match.
Previously unbeaten South Africa would have been the first side to confirm a semi-final spot had they won but will still go through by beating the Netherlands on Sunday.
Pakistan could go through if they beat Bangladesh and South Africa-Netherlands is washed out. The two sides would then be level on six points, but Pakistan would go through by having three wins to the Proteas' two.
Pakistan struggles in this World Cup have largely been down to their batting, including when they failed to chase 131 in a one-run defeat by Zimbabwe.
They looked to be heading the same way again when Mohammad Rizwan played on to Wayne Parnell in the first over and their other out-of-form talisman, captain Babar Azam, was well caught running back from mid-wicket by Kagiso Rabada off the bowling of Lungi Ngidi.
But from 48-4 after 6.3 overs, Shadab and Iftikhar launched a thrilling counter-attack.
Shadab whipped three fours and four sixes, including clear the ropes off successive deliveries from fast bowler Anrich Nortje, who took 4-41 amid the bedlam.
Iftikhar swung Ngidi for a 106m six over the leg-side - the longest hit of the tournament.
Right-hander Shadab's fifty was reached in just 21 balls, making it Pakistan's second fastest in T20s.
South Africa did not help themselves. They dropped four catches in the manic second half of the innings, in which 117 runs were scored.