Costa Rica put a huge dent in Japan's hopes of reaching the World Cup last 16 as they recovered from their 7-0 hammering by Spain to claim a surprise 1-0 victory in Group E on Sunday.
The door was wide open for Japan to seal their place in the knockout round after their historic opening win over Germany.
But Keysher Fuller's curling 81st-minute effort, Costa Rica's first shot on target in the entire tournament, rocked Japan and put their hopes of progression in peril.
When Fuller's left-footer crept into the top of the net despite Japan's keeper Shuichi Gonda's doomed attempt to keep it out, Costa Rica's players and fans were in delirium.
There may also have been cheers of relief in the Germany camp because if Japan had won, Germany would have been under intense pressure to beat Spain in the group's later game.
Japan oddly made five changes to their starting line-up and despite beefing up their attack with substitutions in the second half they were punished for not taking the initiative against shell-shocked opponents.
They are still second in the group on three points but with their last game against Spain the odds on them reaching the knockout stage for a fourth time have lengthened considerably.
Costa Rica, written off as whipping boys before kickoff, snapped a seven-match winless run at the World Cup to move to three points and now have a possible route to the last 16.
Their manager Luis Fernando Suarez said beforehand that his side were "not dead" and so it proved, although it was a game that will not live long in the memory banks of neutral fans.
A first-half of mind-numbing tedium even tested the patience of the drum-banging Japanese fans massed in their blue shirts at one end of the Ahmad bin Ali Stadium.
Snail's pace
Apart from a burst at the start of the game by Japan, the half was played at snail's pace, although for Costa Rica the lack of goalmouth action was probably welcome seeing as they conceded three times in the opening half an hour against Spain.
Both goalkeepers were redundant and the only incidents that could pass as goalmouth action were a cross by Japan's Ritsu Doan that flashed across the goal and a scooped shot high over the crossbar by Costa Rica forward Joel Campbell.
Japan's coach Hajime Moriyasu took off defender Yuto Nagatomo at halftime and replaced him with attacker Takuma Asano who was surprisingly left on the bench despite scoring the winner against Germany.
Immediately after the break Japan looked more threatening and Hidemasa Morita finally tested Keylor Navas with a stinging left-foot drive which the Costa Rica keeper turned away.
Kicking towards their fans, Japan seized control and Moriyasu made another attacking change with midfielder Kaoru Mitoma coming on for right back Miki Yamane.
Japan's fans kept up a constant din as their side camped in Costa Rica's half and it seemed only a matter of time before their pressure would pay off.
But then the game was turned upside down.
A rare Costa Rica attack was not cleared properly by Japan and the ball fell to right back Fuller who curled his shot towards the top corner.
Time stood still as Gonda sprung to his right to try to claw the ball out, but he could only help it into the net.