Japan failed to take another step towards the World Cup knockout rounds as Keysher Fuller's late goal earned Costa Rica a smash-and-grab Group E victory.
Following their shock win over Germany, Japan were frustrated by a tight defensive unit, before Fuller struck with Costa Rica's first shot on target at the tournament.
The result leaves both teams on three points after two games, with Spain - who still top the group on goal difference - facing Germany later on Sunday (19:00 GMT).
Victory for Spain will all but guarantee their progression to the last 16.
After beating Germany in their opener, many expected Japan to account for a Costa Rica side reeling from a 7-0 thrashing by Spain.
However, Japan boss Hajime Moriyasu opted for rotation over continuity, making five changes, and that resulted in a subdued performance and a scoreline that blew the group wide open.
It was a remarkable victory for Costa Rica, who had failed to lay a glove on the Japan defence before Fuller's deflected shot from the edge of the box escaped goalkeeper Shuichi Gonda's grasp nine minutes from time.
After a first half devoid of goalmouth action in the searing heat at Ahmad Bin Ali Stadium, Japan dominated for large spells. However, they struggled to create clear-cut chances until the 88th minute, when Daichi Kamada could not turn the ball home after a driving Kaoru Mitoma run.
Having achieved redemption following their humiliation at the hands of Spain, the Costa Rica players celebrated emotionally at full-time as Japan were left to rue a disappointing display that failed to back up their heroics against Germany.
Player of the match
MitomaKaoru Mitoma
Japan
Squad number9Player nameMitoma
Squad number5Player nameNagatomo
Squad number4Player nameItakura
Squad number22Player nameYoshida
Squad number8Player nameDoan
Squad number18Player nameAsano
Squad number6Player nameEndo
Squad number15Player nameKamada
Squad number2Player nameYamane
Squad number24Player nameSoma
Squad number10Player nameMinamino
Squad number21Player nameUeda
Squad number13Player nameMorita
Squad number14Player nameIto
Squad number26Player nameIto
Squad number12Player nameGonda
Costa Rica
Squad number9Player nameBennette
Squad number4Player nameFuller
Squad number1Player nameNavas
Squad number20Player nameAguilera
Squad number17Player nameTejeda
Squad number15Player nameCalvo
Squad number5Player nameBorges
Squad number8Player nameOviedo
Squad number12Player nameCampbell
Squad number19Player nameWaston
Squad number6Player nameDuarte
Squad number7Player nameContreras
Squad number14Player nameSalas
Squad number2Player nameChacón
Squad number13Player nameTorres
Line-ups
Japan
Formation 4-2-3-1
12Gonda
2Yamane4Itakura22Yoshida5Nagatomo
6Endo13Morita
8Doan15Kamada24Soma
21Ueda
12Gonda2YamaneBooked at 44minsSubstituted forMitomaat 62'minutes4ItakuraBooked at 84mins22Yoshida5NagatomoSubstituted forItoat 45'minutes6EndoBooked at 90mins13Morita8DoanSubstituted forItoat 67'minutes15Kamada24SomaSubstituted forMinaminoat 82'minutes21UedaSubstituted forAsanoat 45'minutesSubstitutes
1Kawashima3Taniguchi7Shibasaki9Mitoma10Minamino11Kubo14Ito16Tomiyasu17Tanaka18Asano19H Sakai20Machino23Schmidt25Maeda26ItoCosta Rica
Formation 3-4-2-1
1Navas
6Duarte19Waston15Calvo
4Fuller5Borges17Tejeda8Oviedo
13Torres12Campbell
7Contreras
1Navas6Duarte19Waston15CalvoBooked at 70mins4Fuller5BorgesBooked at 61minsSubstituted forSalasat 89'minutes17Tejeda8Oviedo13TorresSubstituted forAguileraat 65'minutes12CampbellSubstituted forChacónat 90+5'minutes7ContrerasBooked at 41minsSubstituted forBennetteat 65'minutesSubstitutes
2Chacón3Vargas9Bennette10Ruiz11Venegas14Salas16Martínez18Alvarado20Aguilera21López22Matarrita23Sequeira24Wilson25Hernández26ZamoraReferee:Michael OliverAttendance:41,479Live Text
Match ends, Japan 0, Costa Rica 1.
Second Half ends, Japan 0, Costa Rica 1.
Junya Ito (Japan) wins a free kick on the right wing.
Foul by Bryan Oviedo (Costa Rica).
Substitution, Costa Rica. Daniel Chacón replaces Joel Campbell.
Foul by Kaoru Mitoma (Japan).
Keysher Fuller (Costa Rica) wins a free kick in the defensive half.
Wataru Endo (Japan) is shown the yellow card for a bad foul.
Foul by Wataru Endo (Japan).
Yeltsin Tejeda (Costa Rica) wins a free kick in the defensive half.
Substitution, Costa Rica. Youstin Salas replaces Celso Borges.
Attempt saved. Daichi Kamada (Japan) right footed shot from the centre of the box is saved in the bottom left corner. Assisted by Takuma Asano.
Ko Itakura (Japan) is shown the yellow card for a bad foul.
Foul by Ko Itakura (Japan).
Jewison Bennette (Costa Rica) wins a free kick on the left wing.
Substitution, Japan. Takumi Minamino replaces Yuki Soma.
Goal! Japan 0, Costa Rica 1. Keysher Fuller (Costa Rica) left footed shot from the centre of the box to the top left corner. Assisted by Yeltsin Tejeda.
Offside, Costa Rica. Brandon Aguilera tries a through ball, but Keysher Fuller is caught offside.
Corner, Japan. Conceded by Óscar Duarte.
Corner, Japan. Conceded by Keysher Fuller.
Get the latest results and goal notifications for any team at the Fifa World Cup by downloading the BBC Sport app: Appleexternal-link - Androidexternal-link - Amazonexternal-link
Get your daily dose of Fifa World Cup reaction, debate & analysis with World Cup Daily on BBC Sounds