Chris Martin celebrates after scoring Scotland's winning goal against Slovenia
Defender Russell Martin had the ball in the net early in the first half only to be punished for an infringement, before striker Leigh Griffiths twice hit the woodwork.
Time seemed to be running out for Gordon Strachan’s side but with two minutes remaining Martin, on for James Morrison five minutes earlier, took a Stuart Armstrong pass and fired a low drive past goalkeeper Jan Oblak and in at the far post.
Hampden Park had been quiet in the build-up, but those Tartan Army members who did turn up got behind their team and were rewarded by a bright start by the Scots.
Robert Snodgrass’s corner from the right just after a minute was met by the boot of Scotland defender Russell Martin eight yards out, but Slovenia keeper Jan Oblak parried to safety.
Six minutes later Martin headed the next Snodgrass corner into the net, but Dutch referee Bjorn Kuipers ruled he had pushed marker Miral Samardzic before doing so, to end Scottish celebrations.
Leigh Griffiths hit the woodwork twice at Hampden Park
Stars who have played in both Scottish and English Premier Leagues
Fri, April 15, 2016
Express Sport takes a look at some of the greatest players who have appeared in both the English and Scottish top flights in recent times
1 of 36
Express Sport takes a look at some of the greatest players who have played in both the Premier League and the Scottish Premier League (now Scottish Premiership)
Get Quotes on Home Insurance
Slovenia were showing little as an attacking force, but in the 19th minute Roman Bezjak was sent down the left by Jasmin Kurtic and he blasted his shot from a tight angle straight at Scotland keeper Craig Gordon.
The home fans jeered when Slovenia skipper Bostjan Cesar was booked in the 22nd minute for time wasting at a free-kick.
Six minutes later they almost cheered when a rising drive from midfielder James Morrison from the edge of the box missed the target by inches.
The opener which should have come in the 34th minute when Griffiths volleyed a Snodgrass cross off the crossbar from four yards out.
Moments later the Hoops forward then smacked the post with a low right-footed drive from Armstrong’s cutback, before a header from Morrison was cleared off the line by Slovenia attacker Valter Birsa.
Griffiths, who had picked up a lower back injury when challenging Oblak in the first half, was replaced by Steven Naismith four minutes after the restart.
Chris Martin shoots to score Scotland's winner against Slovenia
Hampden fell quiet again as the tempo dipped.
The home side tried to step up the pace but Slovenia, all work rate and little flair, would not allow Strachan’s men to build any rhythm.
Belief appeared to slip ever so slowly as the second half entered its final stages.
Slovenia, for their part, seemed happy to make sure they held on to the point.
Ikechi Anya came on for Snodgrass in the 74th minute and with his first touch produced a tame finish from 12 yards after being set up by Forrest which allowed Oblak to smother easily.
It was another good opportunity missed by the home side, but with two minutes remaining Martin, who had replaced Morrison, took an Armstrong pass inside the box before drilling a shot in off the far post and Hampden at last came alive.
Scotland: Gordon; Tierney, Martin, Mulgrew, Robertson, Brown, Morrison (Martin 82), Forrest, Armstrong, Snodgrass (Anya 75), Griffiths (Naismith 50).
Goal: Martin 88.
Slovenia: Oblak, Aljaz Struna, Samardzic, Cesar, Jokic, Kurtic, Krhin, Kampl (Omladicat 87), Ilicic, Birsa (Bericat 69), Bezjak (Verbicat 58). Booked: Samardzic, Cesar, Jokic, Birsa, Bezjak
Referee: Bjorn Kuipers (Holland).