Pakistan kept their faint hopes of qualifying for the semi-finals of the ICC Cricket World Cup with victory over South Africa at Lord's on Sunday.