Photo/Illutration Japanese fans cheer ahead of the Japan-Costa Rica match at Ahmed bin Ali Stadium in Qatar on Nov. 27. (Shinnosuke Ito)

Japan has taken a much more difficult route to advance to the next round of the World Cup in Qatar.

After rallying late to shock Germany 2-1 in its first game, Japan became an upset victim itself on Nov. 27 by losing to Costa Rica 0-1.

The standings for Group E, to which Japan belongs, became more complicated after Spain and Germany played to 1-1 draw.

Japan can control its destiny in the tournament by pulling off another big upset, against Spain, in the final group match that starts at 4 a.m. on Dec. 2 Japan time.

Spain, a former World Cup champion ranked seventh in the world, now leads Group E with four points.

Both Japan, ranked 24th in the world, and Costa Rica, ranked 31st, have three points. But Japan is in second place in the Group E standings because its goal difference is better than that of Costa Rica, which got pummeled by Spain 7-0 in their first game.

Costa Rica is in third place in the group, followed by Germany, ranked 11th in the world, with one point.

The following are the three scenarios for Japan’s fate in the World Cup:

JAPANESE VICTORY

If Japan beats Spain, Samurai Blue will have six points to secure one of the top two places in Group E and advance to the round of 16, regardless of the result of the Costa Rica-Germany match.

JAPANESE LOSS

If Japan loses to Spain, the Japanese will exit the World Cup.

JAPANESE DRAW

If Japan draws with Spain, the Spanish team will have five points and a ticket to the knockout stage.

Japan will have four points and could still advance depending on the result of the Costa Rica-Germany match.

If Costa Rica beats Germany, the Central American nation will have six points, and Japan will be knocked out of the World Cup.

A draw between Costa Rica and Germany would mean both Japan and Costa Rica have four points.

But because Japan’s goal difference will be zero, compared with minus 6 for Costa Rica, Japan would head to the knockout stage.

If Germany defeats Costa Rica, both Japan and Germany will have four points.

A German victory by two or more goals would mean that Germany would advance instead of Japan based on goal difference.

However, if Germany beats Costa Rica by only one score, the goal differences of Germany and Japan will be the same. Whichever team has the most total goals in the tournament will go to the knockout stage.

And if the total scores of the two countries are the same, Japan will advance because it defeated Germany in their head-to-head match.