The result left Uruguay’s World Cup ambitions in disarray in this, one of the toughest groups in the tournament.
They face England in Sao Paulo next while the jubilant Costa Ricans, who have only once made it out of the group stages at a World Cup, travel to Recife to take on Italy.
The Italians will not take that match lightly. Costa Rica were every bit as good as Uruguay in the heat of Fortaleza’s Castelao arena and thoroughly deserved to win.
Promising young striker Joel Campbell set them on the way, chesting down a cross from the right after 54 minutes and slamming home a low shot to cancel out Edinson Cavani’s first- half penalty.
Centre back Oscar Duarte then put the Central Americans ahead just three minutes later with a brave diving header at the back post from a Christian Bolanos free kick.
Substitute Marco Urena completed one of most memorable victories in his country’s modest footballing history with a third in the 84th minute, silencing an army of sky blue-clad fans who had made the trip north from the River Plate.
To compound Uruguay’s misery, defender Maxi Pereira became the first man to be sent off at this World Cup when he was shown a straight red for upending Campbell with a nasty kick to the shin in stoppage time.
“I didn’t hear anyone saying Holland would be favourites against Spain or that Costa Rica would win,” Uruguay coach Oscar Tabarez told reporters.
“But that’s what we saw. Once the game starts, everything depends on the mentality of the players.”
The final whistle sparked jubilant celebrations from the heavily outnumbered Costa Rican fans.
The have not made it to the knock-out stage of a World Cup since 1990 in Italy. At their last attempt, in Germany in 2006, they lost all three matches and conceded nine goals.
Saturday’s game looked to be heading the same way early on.
The Uruguayans controlled much of the play and went ahead through Cavani’s penalty after Diego Lugano went down in the box under pressure from Costa Rica defender Junior Diaz.
It was yet another slightly dubious penalty decision at this World Cup. Diaz clearly had his arms around the waist of his opponent but even so the Uruguayan captain made a meal of the challenge.
Nevertheless, German referee Felix Brych pointed to the spot and Cavani slammed home the kick, beating Costa Rica’s highly-rated goalkeeper Keylor Navas at his left post.
But even then there were signs of what was to come.
The Costa Ricans looked sharp on the counter-attack good from set pieces, forcing a number of corners and troubling keeper Fernando Muslera with their aerial threat.
With his side trailing 2-1, Tabarez sent Luis Suarez out of the dug-out to warm up, although in the end he chose not to throw him on as a substitute.
If the South Americans are to progress in Brazil, they may need Suarez to recover fully from his recent knee operation before their two tough remaining group matches.
(Editing by Ed Osmond)