Babar Azam's 13th ODI century propelled Pakistan to a dramatic three-wicket victory over South Africa as Temba Bavuma suffered defeat in his first game as limited-overs captain.
Bavuma, who replaced Quinton de Kock as skipper, could only manage one run with the bat at Centurion, but Rassie van der Dussen's unbeaten 123 helped South Africa to 273-6.
Captain Babar (103) struck 17 fours as he went at almost a run a ball, with Pakistan 186-2 when he departed.
However, they lost five further wickets for just 85 runs from there as South Africa threatened an unlikely turnaround, with some impressive death bowling from Andile Phehlukwayo fraying the nerves.
But Faheem Ashraf got Pakistan over the line off the final ball to give them a 1-0 lead in the three-match series.
South Africa were reduced to 55-4 after being put into bat by the tourists, whose early inroads owed to a blitz from Shaheen Shah Afridi (2-61), who removed openers Aiden Markram and De Kock before then catching Bavuma at third man off Mohammad Hasnain.
Van der Dussen's 116-run stand with David Miller (50) gave South Africa's innings momentum, though, with Phehlukwayo sharing a stand of 64 as the Proteas' centurion found crucial support from the lower order.
The impact of that assistance looked to be minimal when Pakistan set about their reply, Babar and opener Imam-ul-Haq (70) combining for 177 to lay the platform.
Mohammad Rizwan and Shadab Khan appeared to have steadied the ship after Anrich Nortje (4-51) accounted for Pakistan's talismen as he ripped through the middle order.
But there was to be great drama in the closing overs. Rizwan holed out to deep midwicket off Phehlukwayo and, when Shadab fell to the same bowler going for the big shot on the first delivery of the final over needing only three off six balls, comeback hopes were very much alive.
Phehlukwayo then produced three successive dot balls but Faheem took advantage of a slower ball and a wide delivery to produce the final three runs as Pakistan survived a nervier conclusion than was necessary.
For in-depth, objective and more importantly balanced journalism, Click here to subscribe to Outlook Magazine