Japan potentially jeopardized their path to the World Cup round of 16 Sunday by falling 1-0 to underdogs Costa Rica in their second Group E game in Qatar.

Coming off a historic 2-1 win over Germany in Wednesday's opening clash, the Samurai Blue let slip a golden opportunity to put one foot in the knockout phase against the Central Americans at Ahmad Bin Ali Stadium in Al Rayyan.

Hajime Moriyasu's men were on top for most of the match before Keysher Fuller's goal against the run of play in the 81st minute gave Los Ticos the lead with their lone attempt on target.

Keysher Fuller (far L) of Costa Rica scores against Japan during the second half of a World Cup Group E football match at Ahmad Bin Ali Stadium in Al Rayyan, Qatar, on Nov. 27, 2022. (Kyodo)

The 28-year-old defender curled a lovely left-footed shot past Japanese goalkeeper Shuichi Gonda after Hiroki Ito and Maya Yoshida failed to dispatch a ball in the danger area.

Gonda, who gave away a penalty for Germany's goal on Wednesday, got the fingertips of both gloves to the ball, but could not direct it around his far post.

The upset revived Costa Rica's World Cup campaign after Luis Fernando Suarez's men had capitulated 7-0 to Spain in their opening group match.

Costa Rica players celebrate after beating Japan 1-0 in a World Cup Group E football match at Ahmad Bin Ali Stadium in Al Rayyan, Qatar, on Nov. 27, 2022. (Kyodo) ==Kyodo

"We had to get at least a draw," Yoshida said. "We couldn't break down their defense and our playing tempo became really flat."

With three points, Japan can still advance to the round of 16, but having thrown a lifeline to both Costa Rica and Germany, they now face the daunting task of getting a result against a Spanish side that scored at will against Los Ticos.

"Winning is the only option, we'll recover and prepare well, switch our attention and give everything we have before the Spain game," Yoshida said.

Japan players -- captain Maya Yoshida (22), Wataru Endo (6) and Takumi Minamino (10) -- look dejected after their 1-0 loss to Costa Rica at a World Cup Group E football match at Ahmad Bin Ali Stadium in Al Rayyan, Qatar, on Nov. 27, 2022. (Kyodo) ==Kyodo

Spain, who lead the group on goal difference, can virtually guarantee their knockout-stage berth with a win over four-time champions Germany later in the day.

Moriyasu made five changes to the team that started against Germany four days ago, calling on Miki Yamane, opening-game standout Ritsu Doan, Hidemasa Morita, Ayase Ueda and Yuki Soma for the Costa Rica matchup.

But the changes did not inspire much dynamism from his team, with the first half an uninspired affair. Ueda was particularly impotent up front, repeatedly firing errant passes when Japan needed him to link with a fellow attacker.

Japan's Ayase Ueda heads the ball during the first half of a World Cup Group E football match against Costa Rica at Ahmad Bin Ali Stadium in Al Rayyan, Qatar, on Nov. 27, 2022. (Kyodo) ==Kyodo

Japan had the territorial advantage, but neither side mustered a shot on target in the first 45 minutes, with only five attempts combined. Japan made most of their forays down the left, where Soma and Morita were active.

The best chance of the half came in the first minutes when Soma swung a corner to the near post but Ueda could not connect on a free header.

Japan's Hidemasa Morita (C) shoots during the second half of a World Cup Group E football match against Costa Rica at Ahmad Bin Ali Stadium in Al Rayyan, Qatar, on Nov. 27, 2022. (Kyodo) ==Kyodo

Doan got a murmur from the 41,479 in attendance in the 12th minute when he fired a ball across the six-yard box, but he had no teammates in the vicinity as the ball shot past a diving Keylor Navas in the Costa Rican goal.

Moriyasu brought first-game goal-scorer Takuma Asano and defender Hiroki Ito off the bench to start the second half and immediately Asano had an impact, leaving a ball for Morita to hit and force a diving save from Navas. Asano put a header on target two minutes later, but Navas saved easily.

Japan's Takuma Asano (L) heads the ball during the second half of a World Cup Group E football match against Costa Rica at Ahmad Bin Ali Stadium in Al Rayyan, Qatar, on Nov. 27, 2022. (Kyodo)

The game livened up from the 75th minute when Costa Rica pressed higher up the pitch, giving Japan several opportunities to push forward, but they could not capitalize.

Fuller then made his mark, finding himself in the right place when the Japanese defense tried to be too cute with the ball in their box.

Costa Rica's Keysher Fuller (4) scores a goal during the second half of a World Cup Group E football match against Japan at Ahmad Bin Ali Stadium in Al Rayyan, Qatar, on Nov. 27, 2022. (Kyodo) ==Kyodo

Japan threw everyone forward in the last minutes of the game as they saw their great World Cup start fading, with Kaoru Mitoma and Daichi Kamada linking up to force Navas into a desperate save in the 87th minute, but the Paris Saint-Germain stopper prevailed in a goalmouth scramble.

Costa Rica goalkeeper Keylor Navas (black) makes a save during the second half of a World Cup Group E football match against Japan at Ahmad Bin Ali Stadium in Al Rayyan, Qatar, on Nov. 27, 2022. (Kyodo) ==Kyodo

Mitoma, who looked like Japan's most threatening attacker after his 62nd-minute introduction, said the Asian side must put the frustration behind them and focus entirely on Spain.

"We made many mistakes and conceded when we shouldn't have," Mitoma said. "Today's finished, we'll switch our attention. We have no option but to get the three points and we'll prepare well for it."

Costa Rica players celebrate in the background after taking the lead against Japan during the second half of a World Cup Group E football match at Ahmad Bin Ali Stadium in Al Rayyan, Qatar, on Nov. 27, 2022. (Kyodo)

Related coverage:

Football: Japan, Costa Rica managing different World Cup expectations

Football: Japan prepared for whatever Costa Rica tries: Yoshida

Football: Injured defender Sakai hoping to be fit to play Costa Rica