Colombia defeated Senegal 1-0 to advance to the World Cup round of 16 as Group H winners in a result that sent the African side out of the competition on the fair play ranking.
Yerry Mina's 74th-minute header allowed Colombia to top the group on six points, while Senegal finished level on four points with Japan, who lost 1-0 to already-eliminated Poland in the other group game played simultaneously.
Both Japan and Senegal had even goal differences and had scored four goals each, but Japan advanced as runners-up because they only picked up four yellow cards in the group stage, while Senegal had six.
The fair play ranking is being used as a tiebreaker for the first time at a World Cup. Previously, a random drawing of lots would have decided which team would advance.
Senegal, who had most of the better play in the first half, thought they had a penalty when Sadio Mane went down in the area on 17 minutes under a challenge from Davinson Sanchez.
However, after consultation with the video assistant referee, referee Milorad Mazic deemed Sanchez to have touched the ball and the decision was reversed.
Chances throughout the game were thin on the ground, with Colombia striker Radamel Falcao heading off target in the 25th minute and again in the second half, while substitute Luis Muriel had an effort blocked.
After Poland took the lead over Japan in the other game, a draw would have seen both Colombia and Senegal through, but Mina rose highest to head in Juan Quintero's corner to put the South American side ahead.
It wasn't all good news for Colombia, however, as talismanic forward James Rodriguez left the game in the first half with what appeared to be a recurrence of the calf injury that kept him out of their opening game.
Colombia will face the runners-up of Group G, either England or Belgium, who face off later on Thursday and whose ranking will also be decided via fair play should they draw.
Senegal lost a World Cup group-stage game for the first time in their history. Their elimination means it will be the first time since 1982 that there have been no African teams in the round of 16.
Information from Reuters was used in this report.