MOSCOW — Japan and Senegal wound up with four points apiece when their World Cup group’s final games finished, sending it to a new FIFA tiebreaker rule to determine who advanced to the knockout stage.

Over the course of the three group matches, each team won once and lost once, and they tied each other. Each scored four goals, and each allowed four. But Senegal picked up six yellow cards to Japan’s four.

Here’s how FIFA decides who gets to keep playing when teams tie on points:

a) best goal difference;

b) most goals scored;

c) points from head-to-head games between the teams involved;

d) if more than two teams are tied, best goal difference from matches between the teams involved;

e) most goals scored in all matches between the teams concerned;

f) fewest points deducted based on yellow and red cards received in all group matches, as follows: a 1-point deduction for a yellow card, a 3-point deduction for a red card issued as a result of a second yellow, a 4-point deduction for a straight red, and a 5-point deduction for a straight red issued after a yellow card.

The Union of European Football Associations (UEFA) has used the disciplinary points rule for several years, but FIFA just introduced in 2016. This is the first time it’s been used in a World Cup.

g) drawing of lots by FIFA.

The only time FIFA has ever drawn lots to break a tie in a World Cup group was at the 1990 edition in Italy, when Ireland and the Netherlands tied for second place in their group. The Netherlands wound up third, but both teams had already advanced under the 24-team format in place at the time.