Campbell, on loan at Lorient from Arsenal, scored the only goal in the seventh minute as he calmly slotted home from Bryan Ruiz’s superb pass on Wednesday night.
Striker Steve Morison went closest to an equaliser for Wales as his first-half header struck the bar before landing on the line and being cleared, while captain Craig Bellamy and Hal Robson-Kanu also had chances on a night when the principality remembered one of its most cherished figures.
It was always going to be a difficult night for the Wales players and management given the nature of the occasion as they remembered their former manager.
Prior to kick-off at the Cardiff City Stadium, there were performances from several Welsh artists, while Speed’s sons Ed and Tom led the side out along with captain for the night Craig Bellamy and Aaron Ramsey.
At one end of the ground cards were held aloft to reveal the name ‘Gary’ on the background of a Welsh flag as the anthem was played with a solemn Bellamy arm in arm with his late friend’s sons, while a minute’s applause was also held in honour of Speed and two spontaneous standing ovations took place during the 90 minutes.
Wales’ hopes of marking the occasion with a win were not helped by the absence of Ramsey, Wayne Hennessey and Gareth Bale. The Spurs man being a late withdrawal with a hamstring problem.
And the home crowd were stunned into silence when Costa Rica took a seventh-minute lead.
Ruiz was instrumental in the goal as his perfectly-weighted pass picked out Campbell’s run, and the striker calmly slotted the ball into the bottom right-hand corner.
Bellamy lofted an effort over as Wales sought a response but the threatening Campbell almost grabbed a second as he beat Darcy Blake with ease and forced a sharp save from Lewis Price.
With Costa Rica’s pace and movement causing the Wales defence plenty of problems, and the hosts having their own attacks broken up with ease due to some sloppy passing, the atmosphere grew increasingly muted.
But the home side did manage to raise the noise levels as Costa Rica keeper Keylor Navas beat away a Chris Gunter cross with Joe Allen looking to nip in at the near post, while Morison headed over after being picked out by a David Vaughan corner.
Robson-Kanu was then found by a Bellamy centre, but Roy Miller got a block in on the Reading man’s header before another Vaughan corner saw Morison’s header hit the bar and land on the line before being cleared.
An extended half-time break then saw almost 50 former Wales internationals, including Ryan Giggs and Mark Hughes, take to the field, along with WBO light-heavyweight champion Nathan Cleverly, to pay tribute to Speed.
And Wales came out with a renewed vigour, with Bellamy at the heart of many of their better moments.
First he curled a long-range free-kick over the bar shortly after the resumption and then came within inches of an equaliser.
Allen’s presence unsettled Michael Umana in the Costa Rica defence, and when the ball ran loose Bellamy pounced, but he could not keep his volley down as it flew narrowly over.
Wales were now firmly on top territorially but the visitors served notice of their continued attacking threat as Bryan Oviedo angled drive rolled just wide of Price’s far post.
Robson-Kanu, who had been a peripheral figure then forced Navas into a backpedalling stop with his bending left-foot strike at the other end.
The home side rang the changes, and the withdrawal of Bellamy for Robert Earnshaw saw the forward given a warm ovation by the crowd as he left the field for possibly the last time in a Wales shirt.
Costa Rica could have sealed the win with 12 minutes remaining as a long ball down the middle was brilliantly controlled by Kenny Cunningham, only for the striker’s firm shot to rebound to safety of the outside of a post.
Earnshaw thought he had found an equaliser in the dying stages but it was ruled out for offside, but the whistle had already gone for offside.