Shaheen Afridi has become the youngest ever bowler at 19 years and 90 days to claim a five-wicket haul in the World Cup.
The 19-year-old Afridi returned career-best figures of six for 35 and became youngest player to take a five-wicket haul in World Cup.
Pakistan won four matches in a row, and yet could not make the World Cup semi-finals.
Friday's result means that New Zealand have joined India, Australia and hosts England in the knockout stage.
Teenager Shaheen Afridi took six wickets as Pakistan won the game easily to finish level on 11 points and games won (five) with fourth-placed New Zealand.
Teenage paceman Shaheen Shah Afridi took four wickets as Pakistan limited Afghanistan to 227 for nine in their World Cup match.
Having lost against India in their previous game, Australia returned to winning ways.
David Warner scored a brilliant century before Mohammad Amir took his maiden five-wicket haul in ODIs as Pakistan bowled out Australia for 307.
Pakistan have made two changes. Shoaib Malik and Asif Ali replace Haris Sohail and Imad Wasim.
Since winning the Champions Trophy in June 2017, Pakistan have won just 15 ODIs.