Bangladesh's 322-3 against the West Indies was the only successful chase of more than 250 in this World Cup and South Africa never looked like emulating that feat
Pakistan condemned South Africa to World Cup elimination and kept alive their own slender chances of advancing to the semi-finals with a 49-run win at Lord's on Sunday.
Chasing 309 to remain in the hunt for a last four berth, South Africa's survival bid petered out on 259-9.
Disciplined Pakistan bowling saw Shadab Khan and Wahab Riaz take three wickets each as South Africa surrendered without a fight.
Faf du Plessis's side had already been roughed up by Haris Sohail's brilliant 59-ball innings of 89 in Pakistan's 308-7.
South Africa's fifth defeat in seven World Cup matches confirmed their embarrassingly early exit, with matches against Sri Lanka and Australia still to play.
For just the second time in their history, and the first time since 2003, South Africa have failed to reach the World Cup knockout stages.
The post-mortem into a woeful World Cup campaign will raise pointed questions about the futures of captain Du Plessis and coach Ottis Gibson.
South Africa have been beset by problems on and off the field -- starting when AB de Villiers' late offer to come out of retirement for the World Cup was rejected.
Their campaign got off to the worst possible start when they were thrashed by hosts England in the tournament opener.
Alarm bells were ringing even louder after a dismal defeat to Bangladesh in their second game and by the time India brushed them aside, it was clear South Africa were in turmoil.
An injury that ruled key pace bowler Dale Steyn out of the tournament was another setback.
Their only win to date was against minnows Afghanistan and their mountain of issues proved too much for the uninspired Proteas players to overcome as they slumped to a tame exit.
Pakistan were also playing for their World Cup survival and mustered a far more whole-hearted effort in the must-win clash.
To the delight of their army of fans, who turned Lord's into a vibrant mass of green, Sarfaraz Ahmed's side could still make the semi-finals.
Their second win of the tournament gives them life with three matches remaining in the battle to finish in the top four in the 10-team group stage.
Bangladesh's 322-3 against the West Indies was the only successful chase of more than 250 in this World Cup and South Africa never looked like emulating that feat.
Their task was made all the more difficult when veteran Hashim Amla was trapped lbw by Mohammad Amir for two in the second over.
The Proteas managed only 38 from the first 10 overs and as, the pressure mounted, Quinton de Kock fell for 47, caught on the boundary by the diving Imam-ul-Haq for Shadab's 50th ODI wicket.
On 91-2 in the 20th over and with the required run-rate climbing, South Africa needed a big innings from Du Plessis.
Encapsulating a turbulent World Cup for the skipper and his team, the skipper could not get the job done in their hour of need.
He perished for 63 when a mistimed swipe against Amir ballooned high in the air for Sarfaraz to take a simple catch.
Rassie van der Dussen went in similar fashion, skying Shadab to give Mohammed Hafeez a catch that pushed South Africa towards the exit.
Sohail's dashing display had set the tone for a dispiriting day for South Africa.
The 30-year-old, dropped following Pakistan's opener against the West Indies, made up for lost time as he demolished South Africa's beleaguered bowlers.
Hitting nine fours and three sixes in his ruthless blitz, Sohail gave Pakistan a shot of adrenaline after Babar Azam's more sedate 69 laid the foundations for victory.
Pakistan INNINGS R B
Imam-ul-Haq c & b Tahir 44 58
Fakhar c Amla b Tahir 44 50
Babar c Ngidi b Phehlukwayo 69 80
Hafeez lbw b Markram 20 33
Haris c De Kock b Ngidi 89 59
Imad c sub (Duminy) b Ngidi 23 15
Wahab b Ngidi 4 4
Sarfaraz not out 2 2
Shadab not out 1 1
Extras: (lb6, nb1, w5) 12
Total: (50 overs) 308/7
Fall of wickets: 1-81 (Zaman), 2-98 (Imam), 3-143 (Hafeez), 4-224 (Azam), 5-295 (Imad), 6-304 (Riaz), 7-307 (Sohail)
Bowling: Rabada 10-0-65-0 (1w); Ngidi 9-0-64-3; Morris 9-0-61-0; Phehlukwayo 8-0-49-1 (1nb, 2w); Tahir 10-0-41-2 (1w); Markram 4-0-22-1 (1w)
South Africa INNINGS R B
Amla lbw b Amir 2 3
De Kock c Imam b Shadab 47 60
Du Plessis c Sarfaraz b Amir 63 79
Markram b Shadab 7 16
Dussen c Hafeez b Shadab 36 47
Miller b Shaheen 31 37
Phehlukwayo not out 46 32
Morris b Wahab 16 10
Rabada b Wahab 3 7
Ngidi b Wahab 1 6
Tahir not out 1 3
Extras: 1 (lb1, w5) 6
Total: (50 overs) 259/9
Fall of wickets: 1-4 (Amla), 2-91 (De Kock), 3-103 (Markram), 4-136 (Du Plessis), 5-189 (Van der Dussen), 6-192 (Miller), 7-222 (Morris), 8-239 (Rabada), 9-246 (Ngidi)
Bowling: Hafeez 2-0-11-0 (1w); Amir 10-1-49-2 (1w); Shaheen 8-0-54-1; Imad 10-0-48-0; Riaz 10-0-46-3 (2w); Shadab 10-1-50-3 (1w)
Pakistan won by 49 runs
MoM: Haris Sohail (Pak)