In many ways Scotland only had themselves to blame for defeat with their delivery to striker Mo Johnston rarely good enough to give him a sniff at goal.
Costa Rica, though, defended resolutely throughout the first half.
And moments after the break they took a shock lead through 29-year-old striker Juan Arnaldo Cayasso.
On the map
Hector Marchena made a diagonal run before playing in fellow defender Geovanny Jara.
Jara's crafty backheel then put Cayasso through for a shot on goal.
And with only Jim Leighton to beat he kept his nerve to find the back of the net and put the minnows into the lead.
However, there were still 40 minutes to go and the likelihood was that they would need to brave a Scotland onslaught if they were to cling on for victory.
A period of true dominance for the Scots failed to materialise although they did force goalkeeper Luis Gabelo Conejo into a few good saves.
When Argentine referee Juan Carlos Loustau eventually blew the whistle, the Costa Ricans knew they had achieved a result that would finally put their country on the map.
There was more still to come from them too. A brave performance and 1-0 defeat to Brazil was by no means a disgrace.
By the time the decisive match with Sweden came round, their previous two performances meant they were not viewed as such massive underdogs.
They duly racked up a 2-1 win and booked a surprise place in the next round.
Czechoslovakia had the measure of them there though, running out 4-1 victors.
But thanks to the self-belief garnered from the opening win over Scotland, the whole campaign could be viewed as a success for Milutinovic's men.