Johannesburg: Pakistan's world-record run of 11 straight Twenty20 series victories came to an end on Sunday, as South Africa won the second T20 by seven runs at the Wanderers.
South Africa defended its total of 188-3 after two thrilling final overs, when four Pakistan wickets fell and the tourists ended on 181-7.
It gave South Africa a winning 2-0 lead in the three-match series and saw Pakistan slip to defeat in a bilateral T20 series for the first time in three years.
Chris Morris took two wickets for South Africa in the penultimate over - both bowled - and Andile Phehlukwayo added two more in the last over.
The Proteas held firm after an earlier assault on their total by Babar Azam, who hammered 90 off 58 balls. Babar fell at the start of the 17th over, caught in the outfield off a delivery from Beuran Hendricks, to throw Pakistan off course in what was probably the game's pivotal moment.
Babar's exit started a run of six wickets for 34 runs.
Stand-in captain David Miller led South Africa to victory while Faf du Plessis was rested and did his job in style, smashing 65 off 29 balls with five sixes and four fours to top score for his team.
Miller took 29 runs off Usman Shinwari in the last over of the South African innings, an onslaught that included three sixes and two fours and gave the South African total a completely different complexion.
Miller was responsible for Shinwari returning the most expensive T20 figures ever for Pakistan with his 0-63 off four overs - a rate of 15.75 runs conceded per over. Hasan Ali had the seventh most expensive ever for Pakistan with 0-48 off four.
Miller's unbeaten 62-run partnership with Heinrich Klaasen came off 24 balls and Klaasen contributed only five runs.
Babar played brilliantly - as he's done most of the tour - but fell just 10 runs short of becoming only the second Pakistan batsman and the first in five years to make a century in a T20 international. He hit 13 fours and a solitary six.