Pakistan kept alive their slender hopes of making the semifinals while knocking South Africa out of the ICC World Cup with a 49-run win on Sunday.
Batting first, the 1992 champions posted 308 for seven with Haris Sohail's 59-ball 89 being the highlight of their innings. In reply, South Africa were stopped at 259 for nine in 50 overs.
With just three points from seven outings, South Africa are out of the tournament while Pakistan could still sneak into the semifinals, provided they win their remaining matches and other results go in their favour.
Chasing 309, South Africa began on a poor note, losing Hashim Amla (2) in the second over.
There was swing straightaway for Mohammad Amir and even though the Pakistan pace spearhead's big appeal for an LBW could not impress the umpire, Hawkeye showed the ball would have hit the stumps, giving him a wicket off his first ball.
Skipper Faf du Plessis (63 off 79 balls) joined Quinton de Kock (47 off 60) early and the duo shared a partnership of 87 runs for the second wicket to keep South Africa in the game. De Kock fell three short of a fifty, and the Proteas lost two more wickets after that, giving Pakistan the upper hand.
A 53-run partnership ensued between Rassie van der Dussen (36) and David Miller (31), but the former got out while trying to hit Shadab Khan against the turn. Miller, who failed to make use of two reprieves, was bowled by Shaheen Afridi to dash whatever little hopes South Africa had at that point.
Later, Andile Phehlukwayo blazed away to 46 runs off 32 balls with six boundaries.
Shadab (3/50 in 10 overs) and Wahab Riaz (3/46 in 10) were Pakistan's most successful bowlers, while Amir picked up two wickets.
Earlier, Sohail marked his return with a scintillating knock and powered Pakistan to a competitive total.
Playing in his first match of the tournament since the outing against West Indies in their opener, Sohail smashed nine fours and three sixes.
The 30-year-old added 81 runs for the fourth wicket with Babar Azam (69 off 80 balls), but it was Sohail's brisk 71-run partnership with Imad Wasim (23 off 15 balls), which gave Pakistan innings the impetus it needed in this must-win game.
The last 10 overs yielded 91 runs, with Sohail doing most of the damage.
Pakistan were off to their most convincing start in the tournament, with the opening duo of Fakhar Zaman and Imam-ul-Haq adding 81 runs in just under 15 overs.
Both the openers struck half-a-dozen boundaries each during their stay in the middle but fell for an identical 44.
Fakhar and Imam drove and pulled pacers Kagiso Rabada and Lungi Ngidi (3/64) with authority.
South Africa had their first breakthrough when Imran Tahir (2/41) had Fakhar scooping one to the safe hands of Hashim Amla at first slip.
Tahir went past Allan Donald as the highest wicket-taker for the Proteas at World Cups with 38 wickets when he produced an excellent one-handed catch to dismiss Imam.