|ICC Men's T20 World Cup, Group 1, Sharjah|
|Sri Lanka 142 (20 overs): Nissanka 72 (58); Shamsi 3-17, Pretorius 3-17|
|South Africa 146-6 (20 overs): Bavuma 46 (46), Miller 23* (13); Hasaranga 3-20|
|South Africa win by four wickets|
South Africa pulled off a frantic four-wicket win in the final over against Sri Lanka in the Men's T20 World Cup, despite Wanindu Hasaranga's sublime hat-trick.
With the Proteas needing 16 from the final over, David Miller launched two towering sixes off Lahiru Kumara, before Kagiso Rabada flayed the penultimate ball away for four.
Sri Lanka leg-spinner Hasaranga had seemingly turned the tie in his side's favour by claiming a hat-trick across two overs to leave South Africa struggling on 112-6, chasing 143 to win.
But Miller's composure and impeccable timing carried the Proteas to 146-6 and a vital victory that boosts their chances of reaching the semi-finals from Group 1, having now won two from three.
Sri Lanka opener Pathum Nissanka hit a fine 72 off 58 balls to help his side post 142, despite South Africa spinner Tabraiz Shamsi's superb 3-17.
Defeat does not mathematically eliminate Sri Lanka but a second defeat in three games leaves them very unlikely to progress.
Another thrilling finale
After two enthralling matches on Friday, this World Cup served up a third riveting finish in a row.
While the Proteas were never entirely convincing during their chase, captain Temba Bavuma's composed knock seemed to be steering them home, as they needed 31 from 18 balls, with six wickets in hand.
But then Hasaranga, who bowled Aiden Markram with the final ball of the 15th over, returned to have Bavuma caught before Dwaine Pretorius holed out for a golden duck.
Rabada survived a close lbw shout next up and he and Miller took the target down to 25 from 12 balls.
Unfortunately for Sri Lanka, Hasaranga had bowled his four overs and Rabada hit the previously accurate Dushmantha Chameera for a mighty six in the 19th over before Miller punished two poor deliveries in the slot from Kumara to effectively seal the win.
South Africa wicketkeeper Quinton de Kock took the knee on his return to the side, having apologised after withdrawing from the win over West Indies for refusing to make the gesture.
Spinners shine again
South Africa are a limited team but have an enviable threat in left-arm wrist-spinner Shamsi, the world's number one-ranked T20 bowler.
Similar to Afghanistan's Rashid Khan, Shamsi can rapidly rob teams of strong positions, as he did here by having Bhanuka Rajapaksa and Avishka Fernando chip simple return catches in the 10th and 12th overs.
Sri Lanka had been well placed on 60-1 shortly before, until Charith Asalanka was run out sublimely by Rabada from the deep and Shamsi then took hold.
He picked up his third wicket when Hasaranga picked out a diving Markram to leave Sri Lanka 91-5.
That they posted a testing total was down to Nissanka, the only Sri Lanka to sweetly time the ball throughout as he struck six fours and three sixes, before he fell to Pretorius, who took 3-17.
Shamsi, Hasaranga and Rashid have underlined why they are the top three ranked T20 bowlers. Any time they bowl during this tournament is must-see viewing.
'We've got the best bowling attack in the world' - reaction
South Africa spinner Tabraiz Shamsi: "We were all nervous at the end, but I'm glad to be here and smiling. I've said before it is the best bowling attacking in the world and I stand by that."
South Africa captain Temba Bavuma: "It's quite hard to put into words everything that's happened over the last couple of days. There was a bit of it at the back of the mind but we had a job to do and we had to dig deep.
Sri Lanka captain Dasun Shanaka: "It was enough to defend for Lahiru - he was bowling yorkers and he was superb in the practice games which is why I went with him. It's really hard for us after this game, next two games we hope to keep our pride."