Quinton de Kock's maiden international century helped South Africa clinch the one-day series against Pakistan with a 28- run win in the fourth match in Abu Dhabi.
Wicketkeeper-batsman De Kock hit 112 from 135 balls as the Proteas amassed 266-5, a total their opponents fell well short of as they were bowled out for 238 with four balls to spare.
Skipper Misbah-ul-Haq top-scored with 65 but from a strong position of 174-3 Pakistan collapsed in their run chase, losing their last five wickets for 10 runs.
Dale Steyn sparked the collapse by dismissing Sohaib Maqsood for 56 before going on to flatten the tail, the paceman finishing up with career-best figures of 5-25 from his 10 overs.
Knowing they had to chase down 267 to keep the series alive, Pakistan coasted to 74 without loss thanks to Ahmed Shahzad (43) and Mohammad Hafeez (33), only to then quickly slip to 86-3.
Debutant Maqsood combined with his captain to share in a fourth-wicket stand of 88 and the duo seemed to have their team on course, with at one stage the equation being down to 45 from the final 36 deliveries.
However Steyn emphatically swung the game in South Africa's favour, removing Umar Akmal (22) and Misbah in the space of three balls. Not finished there, he ended the same over by shattering Saeed Ajmal's stumps.
De Kock had earlier picked the perfect time to hit a ton for the first time in his ODI career; he had not got beyond 40 in his previous 14 appearances.
The 20-year-old reached the milestone by thumping seven-foot quick Mohammad Irfan over his head for six, while he also managed nine fours.
Opening partner Hashim Amla was the next highest scorer, adding 46, but the South Africans failed to fully cash in on the early foundations that had been laid.
They lost three wickets at the start of the final 10 overs - including a tiring De Kock who hit a full Junaid Khan ball to Misbah - to lose a little momentum until Ryan McLaren and JP Duminy added 52 in a hurry.
Both cleared the ropes in the penultimate over, which cost the normally frugal Ajmal 15 runs. McLaren finished up unbeaten on 28 with Duminy 25 not out.
The two teams meet in the fifth and final match on Monday in Sharjah before then going on to play each other in two Twenty20 Internationals.