Fakhar Zaman's stunning 193 proved in vain as South Africa levelled the three-match ODI series against Pakistan with a 17-run victory in Johannesburg on Sunday.
Babar Azam's century propelled Pakistan to a dramatic three-wicket win in the first match on Friday, but they fell short of winning the series at the Imperial Wanderers Stadium after some significant contributions at the top of the order from the hosts.
Captain Temba Bavuma was in supreme form, hitting a wonderful 92, while Quinton de Kock (80) and David Miller (50 off 27 balls) helped South Africa to 341.
Zaman's 155-ball 193 was the highest score in a chase in ODI history, although it was not enough to help his side to an improbable victory.
Aiden Markram set the tone for South Africa's innings with an impressive 39, ultimately falling to a Faheem Ashraf delivery.
De Kock and Bavuma anchored South Africa, putting up a 114-run partnership for the second wicket, the former bowled by Haris Rauf 20 runs shy of his century.
Rassie van der Dussen plundered 60 off 37 balls to put the hosts in a strong position, before Bavuma was caught by Azam from Rauf's bowling for 92.
Miller then gave South Africa's total an even healthier look with a half-century.
Pakistan suffered an early blow in the chase when Imam-ul-Haq was dismissed by Lungi Ngidi in the second over, while Anrich Nortje took three quick wickets.
The visitors' hopes of an unlikely win looked in tatters, but Zaman gave them hope with a record-breaking innings.
His spellbinding 193 surpassed Herchelle Gibbs' 175 as the highest individual score at the Imperial Wanderers Stadium, and was the second highest ever in a losing ODI cause.
Zaman fell in the penultimate over when he was run out by Markram after De Kock had cheekily encouraged him to think the ball was going to the other end.