South Africa held out to level the ODI series 1-1 with a 17-run win over Pakistan on Sunday that was much closer than it should have been because of Fakhar Zaman's brilliant 193 in a losing effort.

Pakistan opener Fakhar's score came from 155 balls and he hit 18 fours and 10 sixes to give South Africa a big scare in the second one-day international.

More Images
Pakistan's batsman Fakhar Zaman raises his bat to celebrate scoring a century during the second One Day International cricket match between South Africa and Pakistan at the Wanderers stadium in Johannesburg, South Africa, Sunday, April 4, 2021. (AP PhotoThemba Hadebe)

South Africa held out to level the ODI series 1-1 with a 17-run win over Pakistan on Sunday that was much closer than it should have been because of Fakhar Zaman's brilliant 193 in a losing effort.

Pakistan's batsman Asif Ali plays a high ball from South Africa's bowler Kagiso Rabada delivery during the second One Day International cricket match between South Africa and Pakistan at the Wanderers stadium in Johannesburg, South Africa, Sunday, April 4, 2021. (AP PhotoThemba Hadebe)

Fakhar was run out off the first ball of the last over in unusual fashion. He was running back to the striker's end for two when he slowed down, thinking the throw from fielder Aiden Markram was going to the other end. It wasn't and a direct hit found Fakhar short.

South Africa's bowler Tabraiz Shamsi celebrates after dismissing Pakistan's batsman Shadab Khan on LBW during the second One Day International cricket match between South Africa and Pakistan at the Wanderers stadium in Johannesburg, South Africa, Sunday, April 4, 2021. (AP PhotoThemba Hadebe)

Van der Dussen's 60 came from just 37 balls and Miller's 50 from 27 deliveries to give South Africa late impetus to post its big total of 341-6.

South Africa's captain Temba Bavuma juggles the ball is he takes a catch to dismiss Pakistan's captain Babar Azam for 31 runs during the second One Day International cricket match between South Africa and Pakistan at the Wanderers stadium in Johannesburg, South Africa, Sunday, April 4, 2021. (AP PhotoThemba Hadebe)

The series-deciding final game is on Wednesday.

South Africa's batsman Rassie van der Dussen leaves the field after being dismissed by Pakistan's bowler Mohammad Hasnain for 60 runs during the second One Day International cricket match between South Africa and Pakistan at the Wanderers stadium in Johannesburg, South Africa, Sunday, April 4, 2021. (AP PhotoThemba Hadebe)

South Africa's batsman Rassie van der Dussen leaves the field after being dismissed by Pakistan's bowler Mohammad Hasnain for 60 runs during the second One Day International cricket match between South Africa and Pakistan at the Wanderers stadium in Johannesburg, South Africa, Sunday, April 4, 2021. (AP PhotoThemba Hadebe)

South Africa's batsman Rassie van der Dussen plays a shot during the second One Day International cricket match between South Africa and Pakistan at the Wanderers stadium in Johannesburg, South Africa, Sunday, April 4, 2021. (AP PhotoThemba Hadebe)

South Africa's batsman Rassie van der Dussen plays a shot during the second One Day International cricket match between South Africa and Pakistan at the Wanderers stadium in Johannesburg, South Africa, Sunday, April 4, 2021. (AP PhotoThemba Hadebe)

Pakistan was 205-7 at one stage before Fakhar really got going, but ultimately finished on 324-9 chasing 342 to win at the Wanderers in Johannesburg.

Pakistan's batsman Fakhar Zaman raises his bat to celebrate scoring a century during the second One Day International cricket match between South Africa and Pakistan at the Wanderers stadium in Johannesburg, South Africa, Sunday, April 4, 2021. (AP PhotoThemba Hadebe)

Pakistan's batsman Fakhar Zaman raises his bat to celebrate scoring a century during the second One Day International cricket match between South Africa and Pakistan at the Wanderers stadium in Johannesburg, South Africa, Sunday, April 4, 2021. (AP PhotoThemba Hadebe)

Fakhar was run out off the first ball of the last over in unusual fashion. He was running back to the striker's end for two when he slowed down, thinking the throw from fielder Aiden Markram was going to the other end. It wasn't and a direct hit found Fakhar short.

Even if Fakhar was there to see it through, Pakistan still faced the very steep task of getting 31 off that last over to win.

South Africa's success was down to a thorough batting display, with 80 from opener Quinton de Kock, 92 from new captain Temba Bavuma and half-centuries from Rassie van der Dussen (60) and David Miller (50 not out).

Pakistan's batsman Asif Ali plays a high ball from South Africa's bowler Kagiso Rabada delivery during the second One Day International cricket match between South Africa and Pakistan at the Wanderers stadium in Johannesburg, South Africa, Sunday, April 4, 2021. (AP PhotoThemba Hadebe)

Pakistan's batsman Asif Ali plays a high ball from South Africa's bowler Kagiso Rabada delivery during the second One Day International cricket match between South Africa and Pakistan at the Wanderers stadium in Johannesburg, South Africa, Sunday, April 4, 2021. (AP PhotoThemba Hadebe)

Van der Dussen's 60 came from just 37 balls and Miller's 50 from 27 deliveries to give South Africa late impetus to post its big total of 341-6.

South Africa's bowlers then quickly worked through Pakistan's top order in the chase, with the exception of Fakhar.

Fast bowler Anrich Nortje took 3-63 and the highest score for Pakistan other than Fakhar's 193 was 31 from captain Babar Azam.

South Africa's bowler Tabraiz Shamsi celebrates after dismissing Pakistan's batsman Shadab Khan on LBW during the second One Day International cricket match between South Africa and Pakistan at the Wanderers stadium in Johannesburg, South Africa, Sunday, April 4, 2021. (AP PhotoThemba Hadebe)

South Africa's bowler Tabraiz Shamsi celebrates after dismissing Pakistan's batsman Shadab Khan on LBW during the second One Day International cricket match between South Africa and Pakistan at the Wanderers stadium in Johannesburg, South Africa, Sunday, April 4, 2021. (AP PhotoThemba Hadebe)

The series-deciding final game is on Wednesday.

More AP sports: https://apnews.com/hub/apf-sports and https://twitter.com/AP_Sports

South Africa's captain Temba Bavuma juggles the ball is he takes a catch to dismiss Pakistan's captain Babar Azam for 31 runs during the second One Day International cricket match between South Africa and Pakistan at the Wanderers stadium in Johannesburg, South Africa, Sunday, April 4, 2021. (AP PhotoThemba Hadebe)

South Africa's captain Temba Bavuma juggles the ball is he takes a catch to dismiss Pakistan's captain Babar Azam for 31 runs during the second One Day International cricket match between South Africa and Pakistan at the Wanderers stadium in Johannesburg, South Africa, Sunday, April 4, 2021. (AP PhotoThemba Hadebe)

South Africa's batsman Rassie van der Dussen leaves the field after being dismissed by Pakistan's bowler Mohammad Hasnain for 60 runs during the second One Day International cricket match between South Africa and Pakistan at the Wanderers stadium in Johannesburg, South Africa, Sunday, April 4, 2021. (AP PhotoThemba Hadebe)

South Africa's batsman Rassie van der Dussen leaves the field after being dismissed by Pakistan's bowler Mohammad Hasnain for 60 runs during the second One Day International cricket match between South Africa and Pakistan at the Wanderers stadium in Johannesburg, South Africa, Sunday, April 4, 2021. (AP PhotoThemba Hadebe)

South Africa's batsman Rassie van der Dussen plays a shot during the second One Day International cricket match between South Africa and Pakistan at the Wanderers stadium in Johannesburg, South Africa, Sunday, April 4, 2021. (AP PhotoThemba Hadebe)

South Africa's batsman Rassie van der Dussen plays a shot during the second One Day International cricket match between South Africa and Pakistan at the Wanderers stadium in Johannesburg, South Africa, Sunday, April 4, 2021. (AP PhotoThemba Hadebe)