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.
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.
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 the 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.
The home side did manage to raise the noise levels as Costa Rica keeper Keylor Navas beat away a Chris Gunter cross and Steve 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.
They were firmly on top territorially but couldn’t score and Bellamy was withdrawn for Robert Earnshaw and given a warm ovation by the crowd as he left the field for possibly the last time in a Wales shirt.
Earnshaw thought he had found an equaliser in the dying stages but it was ruled out for offside.