Last updated on .From the section Football

Scotland were overtaken by Slovakia on goal difference on the final round of qualifying

Scotland's hopes of playing in a first World Cup since 1998 were ended by an agonising draw in Slovenia.

Needing a win to move into the play-offs for the 2018 tournament in Russia, Scotland went in front when Leigh Griffiths cracked in an angled shot.

But substitute Roman Bezjak punished some poor defending with two goals after the break before Robert Snodgrass hooked in an equaliser late on.

The result means Scotland finish third on goal difference behind Slovakia.

The Slovaks beat Malta 3-0 in their final qualifying game, to claim second spot but they must wait for other results to discover whether they will make the play-offs.

Scotland's exit guaranteed Northern Ireland's place in the play-offs, as one of the eight best second-placed teams from the nine groups in the European qualifying, before their final qualifier in Norway on Sunday evening, which they lost 1-0.

Ultimately though, this was a heart-breaking end to a campaign that had taken on such a positive complexion in the five-game unbeaten run that took the Scots to within a victory of a play-off spot for the first time since 2003.

Snodgrass' well-taken goal gave Scotland hope of yet another last-gasp victory but Gordon Strachan's side could not find a winner despite Slovenia losing captain Bostjan Cesar to a stoppage-time red card.

The thousands of travelling supporters gave the shattered players a standing ovation at full-time as they were left to reflect on another near-miss.

Strachan's bold-looking decision to change his starting formation to a 4-4-2 to accommodate Chris Martin looked to be paying off during a comfortable first half for the visitors.

Craig Gordon had to make two early saves to keep out shots from Josip Ilicic and Tim Matavz, but otherwise was scarcely worked.

Scotland, with Darren Fletcher exerting his authority in midfield, gradually gained the upper hand, with Andrew Robertson and Martin both going close.

Bezjak (centre) changed the game with two second-half goals for Slovenia

And when Griffiths lashed in his fourth goal in his last five international appearances, the travelling hordes were in raptures.

The Celtic striker latched on to Darren Fletcher's looping headed pass to fire past Jan Oblak from a narrow angle.

It was the first goal Slovenia had conceded at home during qualifying and the belief that this really could happen for Scotland intensified.

But the introduction of Bezjak at half time - allied with a vast improvement from Ilicic - sparked Slovenia into life.

It was the latter's free kick that was headed in at the back post by the substitute and he forced another good save from Gordon before putting the home side in front.

Scotland failed to deal with a corner kick and when it was rolled back to Bezjak, he stroked the ball through a crowded six-yard box and into the net.

It left Scotland needing two goals to finish as runners-up behind England and they should have had one back only for Fletcher to thrash the ball over the bar from 10 yards out.

Snodgrass knocked in the equaliser on 87 minutes

But Snodgrass, minutes after coming on, clipped the ball past Oblak to give his side a glimmer of hope in the final stages of the game.

Matt Phillips almost saw his cutback deflected past the keeper and Snodgrass came close to an injury-time goal, but his header didn't quite have the elevation to beat Oblak.

Amid the late flurry of activity, Cesar was shown a red card on his 100th appearance, but it was too late for Scotland to take advantage and though their unbeaten run now stands at six matches, they and their supporters will once again have to watch a major tournament from home.

What next for Strachan?

What this means for Strachan's tenure as Scotland head coach is not yet clear.

The improvement in form, the loyalty of his players and a desire from within the Scottish FA for him to stay all work in his favour.

Ultimately he will have to decide whether he has the appetite to continue to build on the recent good work.

Match stats

Leigh Griffiths has been involved in seven goals in his past five internationals (four goals, three assists)

Since losing to England in a Euro 2016 qualifier, Slovenia have lost just once at home (W6 D4)

Scotland have gone seven games without defeat for the first time since April 1997

Josip Ilicic has been directly involved in eight goals in World Cup 2018 qualification (three goals, five assists) - more than any other Slovenia player