Pakistan won a bilateral one-day international series against South Africa for the first time when they claimed a one-run victory in a thrilling finale in Port Elizabeth on Wednesday.
Pakistan now lead the three-match series 2-0 with one to play, their victory set up by a superb 102 from Ahmed Shehzad in a match reduced to 45 overs per side after early rain.
The visitors were sent into bat in South Africa's 500th ODI match and amassed a sizeable 262 all out on the back of Shehzad's ton and a pair of 42s from Sohaib Maqsood and Umar Akmal.
Dale Steyn continued his excellent recent form with the ball to record career-best figures of six for 39, a lone hand in a Proteas attack that otherwise battled to contain the visiting batsmen.
South Africa looked to have paced their chase well. Captain AB de Villiers smashed a whirlwind 74 from 45 balls and opener Hashim Amla fell two runs short of his century in the last ball of the penultimate over.
But needing nine off the final over to win with five wickets remaining, the impressive Junaid Khan (three for 42) bowled a number of yorkers that the South African batsmen could not get off the square.
The home side needed a six off the last ball but Khan's legside delivery flicked the pads of David Miller and raced to the fine leg boundary for a four as South Africa ended their innings on 261 for six.
The third and final one-day international will be played in Pretoria on Saturday.