Pakistan pulled off a sensational victory in the second one-day international against South Africa in Port Elizabeth to clinch the series.
South Africa won the toss and decided to bowl first in their 500th ODI, but a century from Ahmed Shehzad led the visitors to 262 in a match reduced to 45 overs by rain.
The hosts looked well on course to chase down that target and needed only 36 off the final 40 balls, but the dismissal of AB de Villiers hindered them badly, and they fell one run short.
|2nd ODI: South Africa v Pakistan at Port Elizabeth|
|Pakistan 262 (45 overs)|
|Nasir Jamshed||b Steyn||2|
|Ahmed Shehzad||run out (Imran Tahir/†de Kock)||102|
|Mohammad Hafeez||c †de Kock b Steyn||8|
|Sohaib Maqsood||c Amla b McLaren||42|
|Misbah-ul-Haq*||c †de Kock b Imran Tahir||12|
|Umar Akmal†||c †de Kock b Steyn||42|
|Shahid Afridi||c de Villiers b Steyn||11|
|Bilawal Bhatti||c †de Kock b Steyn||21|
|Anwar Ali||obstructing the field||7|
|Saeed Ajmal||c Kallis b Steyn||0|
|Junaid Khan||not out||1|
|Extras||(lb 1, w 13)||14|
|South Africa 261-6 (45 Overs)|
|HM Amla||c Mohammad Hafeez b Saeed Ajmal||98|
|GC Smith||c †Umar Akmal b Junaid Khan||1|
|Q de Kock†||c Misbah-ul-Haq b Shahid Afridi||47|
|JH Kallis||c Saeed Ajmal b Shahid Afridi||6|
|AB de Villiers*||c Shahid Afridi b Junaid Khan||74|
|JP Duminy||c Anwar Ali b Junaid Khan||15|
|DA Miller||not out||2|
|R McLaren||not out||0|
|Extras||(b 1, lb 12, w 5)||18|
Opener Shehzad made 102, his third one-day international century, before being run out in the 35th over after stroking eight boundaries and two sixes in his 112-ball knock.
Dale Steyn removed Saeed Ajmal off the final ball of the inning to finish with an impressive bowling figure of 6 for 39.
When Jacques Kallis became Shahid Afridi's second victim in the 26th over, South Africa looked to be in some trouble at 117 for 3 and with the run rate in excess of 7.5 runs per over.
Hashim Amla and AB de Villiers put on 110 for the fourth wicket, but the captain went for 74 in the 39th over after blasting nine boundaries and two sixes in a rapid 45-ball.
Amla fell two runs short of his 12th one-day international century off the final ball of the penultimate over, which left the hosts needing nine off the final six balls.
Junaid Khan had JP Duminy caught at mid-wicket off the second ball, and David Miller was unable to hit the six required off the final ball with the delivery going for four leg byes.
After drawing the T20 Series 1-1, Pakistan won the opening ODI by 23 runs in Cape Town on Sunday. The series will conclude at Centurion on Saturday.