Japanâ€™s surprise loss to already eliminated Poland proved irrelevant as Colombia knocked Senegal out with a 1-0 victory in Samara.
Colombia topped Group H thanks to Yerry Minaâ€™s header in a 1-0 win over Senegal that sent the African side out of the World Cup by virtue of their fair play record â€“ the first nation to exit the tournament by the method.
Both teams were on track to move into the knockout stages with 16 minutes remaining in Thursdayâ€™s clash at the Samara Arena, due to Japan trailing 1-0 to Poland in Volgograd.
But Mina â€“ also on target in Colombiaâ€™s win over Poland last time out â€“ proved the matchwinner for his side with a superb late header that was celebrated in style with a choreographed team dance.
Japan qualify in second place from Group H despite losing to already eliminated Poland. Senegal exit having received six yellow cards to Japanâ€™s four.
Senegal had a first-half penalty ruled out following a VAR review, while Colombiaâ€™s key man James Rodriguez was substituted before the break and could be a doubt for the knockout rounds.
Group Gâ€™s top two England and Belgium await Colombia and Japan in the last 16, with Senegal unfortunate to be knocked out by the slimmest of margins.
Mâ€™Baye Niang missed an early opportunity but the opening exchanges were cagey before referee Milorad Mazic awarded Senegal a penalty in the 17th minute.
After consulting VAR, Mazic judged defender Davinson Sanchez to have won the ball before making any contact with Sadio Mane.
Colombia were struggling to gain a foothold and they were dealt a blow after half an hour.
Star player James, who won the Golden Boot at the last World Cup, was substituted with what appeared to be a recurrence of the injury that kept him out of Colombiaâ€™s 2-1 loss to Japan.
News of Jan Bednarekâ€™s goal for Poland gave a lift to fans of both Colombia and Senegal as the tension levels in Samara continued to rise.
Maneâ€™s slip as he took a free-kick in the 64th minute, the Liverpool forward sending the ball wildly off-target, summed up the lack of quality in the match.
Kalidou Koulibaly got a vital touch on a Luis Muriel drive to deflect the ball narrowly wide as Colombia threatened to turn the group on its head.
And in the 74th minute Colombia scored the decisive goal of the game, Juan Quinteroâ€™s cross perfect for Barcelona defender Mina to rise highest and crash home a stunning header that went through goalkeeper Khadim Nâ€™Diaye.
Senegal knew they were heading out and responded well to Minaâ€™s goal, Ismaila Sarr missing a fine chance after being picked out by Mane.
Colombia settled for their one-goal lead and, despite growing increasingly desperate and frantic in the closing minutes, Senegal could not force in an equaliser to keep them in the World Cup, their fair play record giving them an unwanted piece of history.