Match ends, Japan 2, Spain 1.
Japan scored a controversial winner as they staged another extraordinary World Cup comeback to top Group E ahead of Spain and reach the last 16.
Ao Tanaka claimed Japan's second goal after the Video Assistant Referee ruled the ball had not gone out of play before substitute Kaoru Mitoma crossed from the byeline, even though on first viewing it appeared to have done so.
It proved the decisive moment in a stunning performance against a Spain side who were fortunate to join Japan in the knockout stage.
In a tournament that has been full of shocks, this was perhaps the most dramatic night so far, with Spain left relying on the result of Germany's game with Costa Rica for them to progress.
All four teams had started the evening with a chance of progressing but with Spain needing only a draw to qualify, they were not expected to need any favours from elsewhere.
La Roja were cruising at the break after Alvaro Morata headed home Cesar Azpilicueta's cross from close range, but Japan would quickly turn the game - and the whole of Group E - on its head.
The Samurai Blue sent on substitutes Ritsu Doan and Mitoma at half-time and within six minutes of the restart they had both made a huge impact.
Doan equalised with a fierce shot from the edge of the area and, only 142 seconds later, Mitomo retrieved Doan's low cross and found Tanaka to bundle home from close range in dramatic circumstances.
The goal was initially ruled out by the assistant referee who signalled Doan's cross had gone out of play, but the VAR ruled Mitomo had reached it in time.
To the naked eye it appeared over the line, but the decision was made that the curvature of the ball was hanging over the chalk, to the delight of Japan's players.
Things got even worse for Spain when Costa Rica took a surprise lead over Germany moments later, because at that stage they were heading out.
The big screens at Khalifa International Stadium showed the updated group table, to the disbelief of the Spain supporters, and pretty much everyone else here too.
Luis Enrique's side were in big trouble, and were showing few signs of knowing how to rescue themselves, with only Germany's late rally sending La Roja through as group runners-up on goal difference.
- Did it cross the line? Germany out on dramatic night
- The best social media VAR explainers of Japan's goal
- Reaction to Japan v Spain
Japan face Croatia next
Japan's reward for a remarkable performance is a tie with Croatia in the last 16, while a relieved Spain side will face Morocco.
This stadium was the setting for Japan's stunning victory over Germany in their opening game at this tournament, and it clearly inspired them again.
The high-pressing style that undid Germany had unsettled Spain at times in the first half but there were still few signs of what was to come.
Morata appeared set to be the story of the night when he netted his third goal of this tournament, equalling Telmo Zarra's record from 1950 for scoring on his first three World Cup appearances for Spain.
Japan had other ideas, and tore into Spain from the start of the second half, again refusing to let them settle on the ball as they attempted to build from the back.
Doan started their revival, collecting the ball on the edge of the area after another loose pass forward by Simon, and firing in a thunderous shot that Simon got two hands to but could not keep out.
That sent Japan's followers wild but more excitement would quickly follow thanks to Tanaka, albeit after a lengthy VAR check.
Spain still had virtually the whole of the second half to stage a recovery, but they lacked either energy or ideas - or both - and rarely threatened Shuichi Gonda in the Japan goal.
It was only the news of Germany's comeback that allowed the Spain fans to relax in the closing minutes, with the goals that La Roja scored in their opening 7-0 win over Costa Rica proving decisive in sending them through.
Player of the match
MitomaKaoru Mitoma
Japan
Avg
- Squad number9Player nameMitomaAverage rating
8.83
- Squad number25Player nameMaedaAverage rating
8.43
- Squad number16Player nameTomiyasuAverage rating
8.40
- Squad number8Player nameDoanAverage rating
8.39
- Squad number6Player nameEndoAverage rating
8.26
- Squad number18Player nameAsanoAverage rating
8.15
- Squad number11Player nameKuboAverage rating
8.06
- Squad number17Player nameTanakaAverage rating
8.00
- Squad number13Player nameMoritaAverage rating
7.98
- Squad number22Player nameYoshidaAverage rating
7.84
- Squad number14Player nameItoAverage rating
7.82
- Squad number15Player nameKamadaAverage rating
7.78
- Squad number3Player nameTaniguchiAverage rating
7.74
- Squad number5Player nameNagatomoAverage rating
7.72
- Squad number4Player nameItakuraAverage rating
7.60
- Squad number12Player nameGondaAverage rating
7.02
Spain
Avg
- Squad number9Player nameGaviAverage rating
5.48
- Squad number7Player nameMorataAverage rating
5.46
- Squad number26Player namePedriAverage rating
5.11
- Squad number2Player nameAzpilicuetaAverage rating
4.95
- Squad number21Player nameOlmoAverage rating
4.81
- Squad number16Player nameRodriAverage rating
4.75
- Squad number12Player nameNico WilliamsAverage rating
4.74
- Squad number5Player nameBusquetsAverage rating
4.57
- Squad number4Player nameP TorresAverage rating
4.46
- Squad number14Player nameBaldeAverage rating
4.44
- Squad number23Player nameSimónAverage rating
4.37
- Squad number25Player nameAnsu FatiAverage rating
3.89
- Squad number20Player nameCarvajalAverage rating
3.71
- Squad number10Player nameAsensioAverage rating
3.57
- Squad number11Player nameF TorresAverage rating
3.55
- Squad number18Player nameAlbaAverage rating
3.47
Line-ups
Japan
Formation 3-4-3
- 12Gonda
- 4ItakuraBooked at 39mins
- 22YoshidaBooked at 45mins
- 3TaniguchiBooked at 44mins
- 14Ito
- 17TanakaSubstituted forEndoat 87'minutes
- 13Morita
- 5NagatomoSubstituted forMitomaat 45'minutes
- 11KuboSubstituted forDoanat 45'minutes
- 25MaedaSubstituted forAsanoat 62'minutes
- 15KamadaSubstituted forTomiyasuat 69'minutes
Substitutes
- 1Kawashima
- 2Yamane
- 6Endo
- 7Shibasaki
- 8Doan
- 9Mitoma
- 10Minamino
- 16Tomiyasu
- 18Asano
- 19H Sakai
- 20Machino
- 21Ueda
- 23Schmidt
- 24Soma
- 26Ito
Spain
Formation 4-3-3
- 23Simón
- 2AzpilicuetaSubstituted forCarvajalat 45'minutes
- 16Rodri
- 4P Torres
- 14BaldeSubstituted forAlbaat 68'minutes
- 9GaviSubstituted forAnsu Fatiat 68'minutes
- 5Busquets
- 26Pedri
- 12Nico WilliamsSubstituted forF Torresat 57'minutes
- 7MorataSubstituted forAsensioat 57'minutes
- 21Olmo
Substitutes
- 1Sánchez
- 3García
- 6Llorente
- 8Koke
- 10Asensio
- 11F Torres
- 13Raya
- 15Guillamón
- 17Pino
- 18Alba
- 19Soler
- 20Carvajal
- 22Sarabia
- 24Laporte
- 25Ansu Fati
- Referee:
- Victor Gomes
- Attendance:
- 44,851
Match Stats
- Possession
- Home18%
- Away82%
- Shots
- Home6
- Away12
- Shots on Target
- Home3
- Away5
- Corners
- Home0
- Away2
- Fouls
- Home9
- Away6
Live Text
Post update
Full Time
Second Half ends, Japan 2, Spain 1.
Post update
Attempt missed. Dani Olmo (Spain) right footed shot from outside the box misses to the left. Assisted by Rodri.
Post update
Attempt saved. Dani Olmo (Spain) right footed shot from the right side of the box is saved in the centre of the goal. Assisted by Ferran Torres.
Post update
Attempt saved. Marco Asensio (Spain) left footed shot from outside the box is saved in the bottom left corner. Assisted by Rodri.
Post update
Attempt blocked. Jordi Alba (Spain) right footed shot from outside the box is blocked.
Substitution
Substitution, Japan. Wataru Endo replaces Ao Tanaka.
Post update
Attempt blocked. Marco Asensio (Spain) left footed shot from outside the box is blocked. Assisted by Dani Olmo.
Post update
Marco Asensio (Spain) wins a free kick on the right wing.
Post update
Foul by Kaoru Mitoma (Japan).
Post update
Attempt saved. Ko Itakura (Japan) header from the centre of the box is saved in the bottom left corner. Assisted by Ritsu Doan with a cross.
Post update
Foul by Sergio Busquets (Spain).
Post update
Kaoru Mitoma (Japan) wins a free kick on the left wing.
Post update
Attempt blocked. Dani Olmo (Spain) right footed shot from outside the box is blocked. Assisted by Pedri.
Post update
Attempt blocked. Marco Asensio (Spain) left footed shot from the left side of the box is blocked. Assisted by Jordi Alba.
Post update
Attempt missed. Takuma Asano (Japan) right footed shot from outside the box misses to the right. Assisted by Kaoru Mitoma following a fast break.
Post update
Foul by Kaoru Mitoma (Japan).
Post update
Ferran Torres (Spain) wins a free kick in the attacking half.
Substitution
Substitution, Japan. Takehiro Tomiyasu replaces Daichi Kamada.
Substitution
Substitution, Spain. Ansu Fati replaces Gavi.
Get the latest results and goal notifications for any team at the Fifa World Cup by downloading the BBC Sport app: Apple - Android - Amazon
Get your daily dose of Fifa World Cup reaction, debate & analysis with World Cup Daily on BBC Sounds
Comments
Join the conversation
Since then...
Denmark - out
Belgium - out
Germany - out
Morrocco - top
Argentina - top
Brazil - already through
Japan - top
Respect for all teams from all continents needed...
Like watching a proper game. Thank you Japan.
I ended it on the edge of my seat, white knuckles gripping the armrests, rooting for Japan to win the game and go through with every fibre in my body.
Absolutely deserved win to fight and stay in the World Cup. Made up for the loss to Costa Rica with style.
One of the best redemption arcs in WC football