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 total of 308-7 from their 50 overs.
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 knockout stages.
"The biggest downside is we are not doing ourselves justice as a team," said Du Plessis. "We are not playing the cricket we are capable of and that is extremely disappointing.
"For me the biggest disappointment is we are letting ourselves down with the skill that is in that dressing room."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 and compounded by an injury that ruled pace bowler Dale Steyn out of the tournament.
Their campaign got off to the worst possible start when they were beaten by 104 runs by hosts England in the tournament opener and they never recovered, with a single win to show for their efforts, against Afghanistan.
Pakistan were also playing for their World Cup survival and their army of fans turned Lord's into a vibrant mass of green.
Their second win of the tournament gives Sarfaraz Ahmed's side hope of making the semi-finals, 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.
The Proteas lost Hashim Amla early and managed only 38 from the first 10 overs.
As the pressure mounted, Quinton de Kock fell for 47, caught on the boundary by the diving Imam-ul-Haq for Shadab's 50th one-day international wicket.
Du Plessis perished for 63 when a mistimed swipe against Mohammad Amir ballooned high in the air for wicketkeeper Sarfaraz to take a simple catch.
Rassie van der Dussen (36) went in similar fashion, skying Shadab to give Mohammed Hafeez a catch that pushed South Africa towards the exit.
Earlier, man-of-the-match 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.
"We made some changes today for the good of the team," said Sarfaraz.
"Haris Sohail came in, he was hungry to play in the match and the way he batted was a turning point. You see Jos Buttler play that type of innings so the way he played was fantastic."
"It was a complete bowling effort, Wahab Riaz, Mohammad Amir, Shaheen Afridi all did their bit," he added. "That what has been missing in previous matches."