Arsenal youngster Joel Campbell scored the only goal for the Central Americans, warming-up for CONCACAF competition.
But this was no ordinary friendly for Wales or even a warm-up for the 2014 World Cup qualifiers.
Instead it was a highly emotional fixture for Wales, their first since the death of popular and respected former midfielder Speed, found hanged at his home in November.
Wales manager Chris Coleman admitted he and his players had found it hard to cope with the special atmosphere of the match.
"It was always going to be difficult under the circumstances, it was not our normal preparation," Coleman told Sky Sports 2.
"This was about one guy and it was important we were there to show our support and celebrate his life.
"His two boys have come into the dressing room and onto the pitch and you could see why he was so proud of them.
"It was a strange atmosphere because we were still grieving, but at the same time we had a game to win.
"At the start we weren't really at the races. We had a couple of chances after that but the main reason for tonight was for Speeds," added Coleman, himself a friend and former Wales international colleague of Speed.
"I commend the players, they did their best but I knew we were going to start slow," he added.
"They've been a terrific bunch but they all miss Speeds. We lost on the night but we gave it what we had."
Amid the tributes for Speed before kick-off, arguably the most moving was when fans held up cards that spelt out 'GARY' in the middle of a Welsh flag after his sons had run out with Craig Bellamy, a friend of the former manager, who was captaining his country in the absence through injury of Aaron Ramsey.
But it wasn't long before a Costa Rica team, who last year drew with Argentina and world champions Spain, had taken a seventh minute lead against a Wales side without Tottenham winger Gareth Bale.
Fulham's Bryan Ruiz produced a superb defence splitting pass that found the run of Campbell, currently on loan at French Ligue 1 side Lorient, slotted the ball into the bottom corner to stun Wales.
Campbell nearly had a second when he forced a sharp save from Lewis Price.
Costa Rica gave Wales something of a football lesson for most of the first half with their pace and movement but the Welsh finished the opening period strongly, with the visitors looking vulnerable at corners.
And it was from a corner late in the half that Wales's Steve Morison nearly grabbed an equaliser when, unchallenged, he powered a header towards goal only for the ball to hit the crossbar and land on the line before being cleared.
After the break, Liverpool striker Bellamy went close with a snap shot before Thomas Robson-Kanu drew an excellent diving save from Keylor Navas.
But in the 78th minute Costa Rica's Kenny Cunningham hit the post with a thumping drive.
What the stars mean:
★ Poor ★ ★ Promising ★★★ Good ★★★★ Very good ★★★★★ Exceptional