Pakistani players celebrate after dismissing South Africa's batsman Heinrich Klaasen during the third T20 match at the Centurion Park in Pretoria
The tourists owed their win to the new-ball bowling of left-arm spinner Imad Wasim and left-arm fast bowler Shaheen Shah Afridi as they defended a moderate total of 168 for nine.
The pair restricted South Africa to 30 for two in the first seven overs and the hosts were always behind the required rate as they limped to 141 for nine in their 20 overs.
South Africa won the series against the world's top-ranked Twenty20 international team 2-1, adding to a 3-0 success in a three-match Test series and a 3-2 win in a five-match one-day series.
"Tonight was disappointing but we're really chuffed with a series win against the best T20 team in the world," said South African stand-in captain David Miller. "We've beaten them with a young side. There's a lot of depth in South African cricket."
"A win is always something that gives you satisfaction," said Pakistan captain Shoaib Malik. "Our youngsters have learnt a lot from this tour and we played really good white-ball cricket."
Left-arm opening bowler Beuran Hendricks took a career-best four for 14 as Pakistan's batsmen struggled after being sent in.
Seven Pakistan batsmen reached double figures but the highest score was 26 by Mohammad Rizwan.
A mid-innings collapse when three wickets fell for five runs in nine balls reduced Pakistan to 94 for five, with Rizwan, Malik and Hussain Talat falling in quick succession. Malik was run out for 18 after a mix-up with Talat.
Shadab Khan hit three sixes in the final over from Andile Phehlukwayo to finish with 22 not out off eight balls. He took two wickets in South Africa's innings, including the key wicket of Miller, and was named man of the match. Miller was the man of the series.
South Africa never recovered from their slow start despite innings of 41 by Rassie van der Dussen and an unbeaten 55 off 29 balls by Chris Morris.
Mohammad Amir followed up the tight bowling of Imad and Afridi to take three for 27, while Shadab and Faheem Ashraf took two wickets each.Pull one back
Pakistan
B Azam c Malan b Morris 23
F Zaman c Shamsi b B. Hendricks 17
M Rizwan c Dala b Sipamla 26
S Malik run out (Phehlukwayo) 18
H Talat c Klaasen b Phehlukwayo 3
A Ali c Van der Dussen b Morris 25
I Wasim b B. Hendricks 19
F Ashraf c Miller b B. Hendricks 4
S Khan not out 22
M Amir c Van der Dussen b B. Hendricks 0
Shaheen Shah Afridi not out 0
Extras (lb4, w7) 11
Total (9 wkts, 20 overs) 168
Fall: 1-24, 2-47, 3-89, 4-92, 5-94, 6-129, 7-144, 8-145, 9-146
Bowling: B. Hendricks 4-0-14-4, Dala 2-0-27-0 (1w), Morris 4-0-27-2, Sipamla 2-0-25-1 (1w), Phehlukwayo 4-0-41-1 (5w), Shamsi 4-0-30-0
South Africa
R. Hendricks c and b S Afridi 5
J. Malan b I Wasim 2
H. van der Dussen c S Malik b F Ashraf 41
H. Klaasen c S Malik b M Amir 2
D. Miller c and b S Khan 13
A. Phehlukwayo lbw b S Khan 10
C. Morris not out 55
B. Hendricks b M Amir 3
J. Dala c sub (H Ali) b M Amir 5
L. Sipamla b F Ashraf 0
T. Shamsi not out 0
Extras (w5) 5
Total (9 wkts, 20 overs) 141
Fall: 1-5, 2-14, 3-30, 4-66, 5-72, 6-80, 7-107, 8-121, 9-129
Bowling: I Wasim 4-0-19-1 (2w), S Afridi 4-0-23-1, M Amir 4-0-27-3 (2w), S Khan 4-0-34-2, F Ashraf 4-0-38-2 (1w)
Result: Pakistan won by 27 runs
Series: South Africa won the three-match series 2-1
Toss: South Africa
Umpires: Adrian Holdstock, Bongani Jele (both RSA)
TV umpire: Allahudien Paleker (RSA)
Match referee: Ranjan Madugalle (SRI)