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.