South Africa beat Pakistan by five wickets in Durban to level the five-match one-day series at 1-1 as Andile Phehlukwayo gave a compelling argument to be the Proteas' all-rounder at the Cricket World Cup.
Phehlukwayo took career-best figures of 4-22 to help limit Pakistan to 203 all out, before hitting a career-best 69 not out to lead South Africa to 207-5 in 42 overs after the home team were in deep trouble at 80-5 in the chase.
The all-rounder shared an unbeaten partnership of 127 with Rassie van der Dussen, who was assured for his 80 not out to continue the fine start to his ODI career, having hit 93 on debut in the first game, which Pakistan won by five wickets.
South Africa should have won Tuesday's second game more comfortably after Pakistan were reduced to 112-8, but the tourists salvaged a reasonably competitive score thanks to No. 10 Hasan Ali's counterattacking 59 from 45 balls.
The tailender smashed five fours and three sixes and was backed up by captain Sarfraz Ahmed's 41 - both batsmen were out to Phehlukwayo after putting on 90 for the ninth wicket.
Pakistan roared back into the game when 18-year-old fast bowler Shaheen Afridi removed Hashim Amla, Reeza Hendricks and captain Faf du Plessis quickly to have South Africa struggling at 29-3 in the first six overs.
Phehlukwayo's position in the team has been up for debate but he made sure it was his best performance for his country with a match-winning half-century.
The 22-year-old lived dangerously, surviving a couple of edges and near-misses, but he played with adventure, hitting reverse sweeps regularly off spinner Shadab Khan and launching two big sixes to go with his seven fours.
Watch the third ODI between South Africa and Pakistan, at Centurion, live on Sky Sports Cricket (channel 404) from 10.55am on Friday.