Pakistan opener Fakhar Zaman's world record century was not enough as South Africa held their nerve to win the second ODI in Johannesburg by 17 runs and level the series 1-1 on Sunday.
Zaman scored a scarcely believable 193 from 155 balls as Pakistan made a valiant effort chasing South Africa's total of 341-6, eventually finishing on 324-9.
It was a one-man show from start to finish as Zaman hit 18 fours and 10 sixes. The next best effort by a Pakistan batsman was 31 from captain Babar Azam, with extras contributing 25.
It was the highest score by a player batting second in ODIs, Zaman breaking the record held by Australian batsman Shane Watson, who hit 185 not out against Bangladesh in 2011.
Pakistan were down and all but out at 205-7 with 12 overs to go. Zaman only had tailenders for company but he threw caution to the wind, taking Pakistan close to an unlikely win.
His magnificent innings ended in the final over with 31 needed for victory when he cantered home for a second run off the first ball. However, a throw from the fence by Aiden Markram found him short and denied the left-hander a chance for a second double-ton in the 50-over format.
"Feels great but it would be much better if we had won the game," Zaman said after being declared man of the match.
"Tried my best, but the good thing was that we fought until the end. I can't say if it's my best innings. I enjoyed it, but if we had won I would have said this is my best."
South Africa's impressive total was set up by four fine half-centuries.
Newly-appointed captain Temba Bavuma scored 92 from 102 balls, while opener Quinton de Kock looked edgy in his 80 from 86 balls.
Rassie van der Dussen, who got a century in the first match in Pretoria on Friday, kept up his good form with 60 from 37 balls that included four sixes, before David Miller finished the innings with 50 not out from 27 balls.
Fast bowler Haris Rauf was easily the pick of the Pakistan bowlers with 3-54 from his 10 overs.