South Africa beat Pakistan by an innings and 92 runs in the second Test in Dubai to ensure the series was drawn 1-1.
The Proteas had lost the first contest and were facing their first Test series defeat since 2009, but responded by recording a comfortable victory inside four days.
Pakistan started day four on 132-4 in their second innings and were eventually bowled out for 326 despite a defiant fifth-wicket stand of 197 between Misbah-ul-Haq (88) and centurion Asad Shafiq.
South Africa, who had built a lead of 416 after the first innings, had their success marred by a controversy which resulted in Faf du Plessis being fined 50 per cent of his match fee for "changing the condition of the ball".
After standing firm through the morning and much of the afternoon session, skipper Misbah carelessly slogged at an innocuous delivery outside off stump from part-time spinner Dean Elgar and nicked the ball to first slip.
That left Pakistan on 267-5 and proved to be the breakthrough that South Africa needed as Graeme Smith's men quickly finished off their opponents in the evening session.
Adnan Akmal (5) and Saeed Ajmal (9) were both trapped lbw by Pakistan-born leg-spinner Imran Tahir (3-98), who finished with nine wickets in the match, before Mohammad Irfan was bowled by JP Duminy for 14.
With Zulfiqar Babar absent hurt, South Africa clinched the win when they ended Shafiq's long and impressive vigil, which saw the batsman face 320 balls.
The 27-year-old was tempted out of his crease by Duminy (3-67) off the first ball of the 136th over and was stumped by AB de Villiers.
As well as Du Plessis' fine, Pakistan off-spinner Ajmal also received an official reprimand after he pleaded guilty to a level one breach of the code of conduct during the third day's play.
The two teams will now face each other in a five-match one-day international series, which begins in Sharjah on Wednesday.