Pakistan 308 for 7 (Haris 89, Babar 69, Ngidi 3-64) beat South Africa 259 for 9 (Du Plessis 63, Wahab 3-46, Shadab 3-50)by 49 runs.
London: South Africa were knocked out the World Cup as Pakistan inflicted a fifth defeat on the struggling Proteas to keep their own semi-final hopes alive.
In the must-win meeting, the 1992 champions won by 49 runs to register just their second win from six games.
Haris Sohail's entertaining 89 and 69 from Babar Azam saw Pakistan make 308-7 after they won the toss at Lord's.
Despite 63 from captain Faf du Plessis, South Africa never got up with the required rate and finished on 259-9.
Beaten semi-finalists in 2015, South Africa were ranked fourth coming into the tournament.
But a wretched showing, with just a solitary victory against Afghanistan to date, means they now have just pride to play for in their remaining two games, against Sri Lanka on Friday and Australia on 6 July.
Pakistan, meanwhile, who have flitted between impressive and woeful in their six games so far, can still make the semi-finals themselves after climbing two places to seventh.
They may still need to win all three of their remaining games, starting against group leaders New Zealand at Edgbaston on Wednesday, and hope other results go their way.
After Saturday's two World Cup games had served up a couple of last-over nail-biters there was hope a sell-out Lord's crowd would be treated to a similar story.
Ultimately, however, they witnessed a fairly comfortable victory for a Pakistan team which could yet pip England to a semi-final place.
Well supported by their vibrant fans, they set off like a train, their top order seemingly determined to put in a strong performance after the previous Sunday's heavy loss against fierce rivals India.
Fakhar Zaman and Imam ul-Haq (both 44) put on an entertaining 81 for the first wicket.
Fakhar, however, was handed a reprieve on 28 in a controversial moment that saw a catch at deep square leg claimed by Imran Tahir given not out.
It was a decision that split the opinions of players, pundits and supporters inside the ground, but there was not enough definitive evidence for third umpire Chris Gaffaney to overturn the on-field umpire's assertion the ball had bounced into the 40-year-old's hands.
Tahir (2-41) was to get a degree of revenge, though, claiming the wickets of both openers, including Imam with a brilliant one-handed low catch off his own bowling.
Tahir was the only threat as a largely blunt South Africa bowling attack was unable to remove Pakistan's middle order after that, allowing Sarfaraz Ahmed's side licence to go big in the latter stages.
Their last 10 overs saw 90 runs added as they raced from 218-3 to 308-7.
Haris was the chief tormentor, hitting nine fours and three sixes in his 59-ball 89 as he shared quickfire partnerships of 81 from 70 balls with Babar and 71 off 40 with Imad Wasim.