The Tartan Army would have been expecting more of a response from their side following Marco Urena's early goal but they struggled to break down Oscar Ramirez's well organised team.
The football was scrappy from both sides but Costa Rica, who are preparing to play in their second consecutive World Cup finals after qualifying for this year's tournament in Russia, were more cohesive in the final third.
McLeish handed a debut to Manchester United midfielder Scott McTominay but he failed to impress during his hour on the field as Scotland slipped to their second successive home defeat.
Costa Rica won by the same scoreline as in their only previous meeting between the two teams when McLeish lined up as a centre-back at the 1990 World Cup.
Scotland were undone after 14 minutes when Bryan Oviedo scampered down Costa Rica's left wing and cut the ball back into the box to Urena who instantly applied a simple, side-footed finish, sending the ball beyond Alan McGregor and into the bottom right corner of the net.
Callum Paterson headed narrowly wide from a corner moments later and Scotland slowly worked their way into the game as lone striker Oliver McBurnie dropped deeper to collect the ball and carry it forward.
McBurnie gave Costa Rica goalkeeper Keylor Navas his first test, picking up Andrew Robertson's pass and jinking inside two defenders before rattling a low shot towards goal that the Real Madrid man did well to parry away.
On-loan Barnsley striker McBurnie claimed he was fouled in the penalty area when attempting to connect with Robertson's dangerous cross but his pleas went unheeded and Scotland trailed at the break.
Bryan Ruiz hit the crossbar after he caught Robertson out of position and then dribbled into the box to unleash a shot that beat McGregor but was high of the target.
Newcastle United winger Matt Ritchie had Scotland's best chance to score when Callum McGregor played him in on goal but his rising shot was parried over the crossbar by Navas.
Robertson broke into the penalty area moments later and delivered a cross that rolled along the edge of the Costa Rica penalty area but McBurnie couldn't quite get there in time to attempt a shot.
Scotland's second-half improvement might have been rewarded with an equaliser had captain Charlie Mulgrew anticipated Ritchie's far-post cross from the right with 10 minutes remaining, but the Blackburn Rovers man timed his run late and watched as the ball flew past him along with any hope of the home side levelling the match.
Key Opta stats:
- Scotland have lost back-to-back home games for the first time since September 2013. In fact, it’s the first time they have lost two in a row at home without scoring a goal since November 2000 (three in a row).
- Scotland have conceded more goals in their last three international fixtures (four) than they had in their previous six combined (three) – they had kept three clean sheets in a row prior to this.
- Alex McLeish has now lost three consecutive matches as Scotland manager, having also lost to Georgia (2-0) and Italy (2-1) in 2007 in the final two games of his first spell in charge.
- Four of Costa Rica’s last six international goals have been bagged by Marco Ureña.