How Long Charlie Puth Download 'How Long' on iTunes
Ikechi Anya scored on his first international start before Shaun Maloney secured victory for Scotland with a stunning late free-kick in Skopje.
Anya caused Macedonia problems all night and finished brilliantly on the hour mark as Scotland were rewarded for taking the game to their hosts. Substitute Matt Gilks made a number of excellent saves before Ivan Kostovski levelled in the 84th minute, but Maloney curled into the top corner five minutes later to lift Scotland off the bottom of their World Cup qualifying group.
The win took Scotland above their hosts before their final game in Group A against Croatia and provided further cause to believe that the team is heading in the right direction under Gordon Strachan. Anya, who made his debut in the 2-0 defeat by Belgium on Friday, made a huge impact from the start with his eagerness and ability to get round the outside and get balls into the box.
Ikechi was one of three changes with Barry Bannan recalled and Steven Naismith starting up front. Leigh Griffiths, James Forrest and the suspended Robert Snodgrass dropped out.
The pitch at the Philip II Arena had been much criticised after Macedonia's 2-1 win over Wales on Friday and there were dozens of small patches of repaired turf in the half Scotland were shooting into in the opening period, although it looked bumpy all over.
Bannan started on the right flank and he set up the first half-chance with a sharp pass forward for Naismith, who fired wide from a difficult angle. Anya got several balls into the box in the opening quarter without any falling for a team-mate.
The home fans were growing audibly frustrated by their team's inability to make tracks into Scotland's final third and their mood nearly deteriorated in the 26th minute following more positive wing play from the Watford player.
This time his cross fell for a Scotland player but Naismith headed over from 10 yards.
Anya threatened again moments later but his cutback just evaded Naismith.
Scotland kept on the pressure and Alan Hutton's low cross was diverted just past the post before Grant Hanley headed wide from Bannan's corner.
Scotland had an even better chance in the 32nd minute when Naismith lifted the ball over the Macedonian defence to feed Scott Brown's forward run.
The Celtic captain was clean through but his left-footed effort hit the diving Tome Pachovski.
Steven Whittaker soon overlapped Ikechi but Pachovski smothered his low cross.
The Scots came close again when Whittaker burst forward and fed Anya, whose first-time curling effort from 25 yards was pushed over by Pachovski.
Hanley's volley was blocked in the goalmouth from the resulting corner before the visitors had their first scare of the night when Aleksander Trajkovski broke down the left with Scotland short of bodies in defence.
The left winger found Adis Jakovikj with a reverse pass but he shot into the side netting.
Scotland were forced into a half-time change with Matt Gilks making his competitive debut after David Marshall went off with a hip injury.
Macedonia enjoyed their first spell of sustained pressure but Gilks was untroubled and Anya curled wide from 20 yards after a counter-attack.
Scotland took the lead after a promising Macedonian break ended with Mirko Ivanovski shooting well wide. Bannan fizzed a pass to Anya in a couple of yards of space on the edge of the box.
The Glasgow-born wide man took a good touch, ran into the box and fired a left-footed effort just inside the far post before running towards the Scotland fans in delight.
Scotland sat back and Charlie Mulgrew was booked for a poor challenge in the centre circle.
The hosts initially struggled to break Scotland down but Gilks made three excellent saves within five minutes. Tasevski set up the first chance with a probing pass from the centre circle which found Ivan Trickovski.
The winger tried to shoot across Gilks but the Blackpool goalkeeper got down well to save before grasping the loose ball.
Scotland were then caught on the counter-attack and Macedonia worked the ball to Mirko Ivanoivski on the right and Gilks pushed away his swerving strike.
The Blackpool goalkeeper then pushed over a first-time effort from Trickovski, who soon volleyed into the side net.
Maloney fired just wide at the other end and Whittaker and Anya were booked for time-wasting before Ivanovski fired over from 20 yards.
Scotland looked to have weathered the storm and had plenty of men back when Maloney lost the ball but substitute Kostovski got ahead of the visiting defence to meet Pandev's dinked cross from the left and he stabbed it past Gilks as the keeper came out.
However, the Scots hit back after sub James McArthur was brought down 22 yards out after skipping in between two defenders.
Maloney took the free-kick and curled it superbly into the top corner past the diving goalkeeper.
There was still time for Kostovski to head wide from a decent chance before sub Lee Wallace came very close with the last kick of the ball.