Spain and Germany drew 1-1 in their World Cup Group E encounter late Sunday in Qatar, meaning all four teams in the group still have a chance of progressing to the round of 16.
Japan's loss to Costa Rica earlier the same day left them second in the group with three points, behind leaders Spain on four and ahead of Costa Rica on goal difference. Germany were fourth on one point.
Japan face Spain on Thursday with a win by the Samurai Blue enough to put them through. If Japan and Spain draw, Germany can advance if they beat Costa Rica by two goals or more or win by a single goal and score more goals than Japan do against Spain.
If Spain beat Japan, they will advance as the group winners and Japan's tournament will be over.
Germany need nothing less than a win in their final game to have a chance.
Spain looked to be on their way to a win against Germany when substitute Alvaro Morata scored in the 62nd minute.
The Atletico Madrid striker scored for his second straight game off the bench, this time with a sublime right-footed flick from a Jordi Alba pass.
But Germany substitute Niclas Fuellkrug came to his team's rescue, blasting a right-footed strike past Spanish goalkeeper Unai Simon in the 83rd minute to secure a point and extend his team's life in the tournament.