Ciro Immobile spared Italy from a rare qualifying defeat by scoring two goals that lifted the Azzurri to a 3-2 victory in Macedonia.
Spain's 2-0 triumph in Albania would have left Italy struggling to make up ground in the race to reach the 2018 World Cup, given Andrea Belotti's first-half opener was cancelled out by Ilija Nestorovski and Ferhan Hasani shortly after half-time at the Philip II Arena.
But former Borussia Dortmund and Sevilla striker Immobile twice linked up with Antonio Candreva to rescue three points for Italy, also extending their 10-year unbeaten run in qualifiers.
Italy arrived in Skopje knowing that defeat -- however unlikely -- would put them in a precarious position in Group G.
They were given an early warning that the feared outcome was possible by a familiar face, Genoa striker Goran Pandev shooting straight at Gianluigi Buffon inside two minutes.
Candreva briefly silenced the baying home crowd by smashing home, although he had been offside when converting Immobile's headed knockdown.
Giacomo Bonaventura's sighter was of no use and Macedonia had much better luck from distance, Nestorovski clattering the crossbar with a dipping drive.
Italy responded by turning the screw and, just a minute after Immobile forced Martin Bogatinov to tip the ball around a post, Belotti scored the opener.
The Torino striker opened his senior goal account by storming into the box to volley home Federico Bernardeschi's corner, and he duly celebrated with his patented 'rooster's comb' gesture.
Italy should have put Macedonia away at that point but neither Belotti nor Bonaventura could capitalise on good chances.
It was another Serie A player, Palermo's Nestorovski, who wounded his country of residence with a 57th-minute equaliser.
After intercepting a poor pass by Marco Verratti, he streaked forward before curling the ball beyond a baffled Buffon.
That was enough for Italy to digest but they had more food for thought only two minutes later.
Nestorovski, who would later be withdrawn to a standing ovation, slipped a pass to Hasani that was drilled into Buffon's unusually leaky net.
The veteran Juventus keeper was under siege again when Daniel Mojsov headed against his gloves on 70 minutes and he had his palms warmed by Ergjan Alioski when Italy's defence went missing.
Someone needed to give Buffon a break and ease the pressure on a disorientated backline, and Immobile rose to the challenge.
Candreva did most of the work, making space on the right side of the box before providing the low cross Immobile met for a close-range finish.
The Lazio striker should have done better with his next attempt, though, while substitute Nicola Sansone also found Mojsov to be a modern day Macedonian phalanx.
Bogatinov pulled off a stunning save against Marco Parolo's header as Italy poured forward in search of a late winner.
With a minute remaining, Parolo did nod the ball over the line, only to be denied by the offside flag.
Nerves were therefore starting to fray as the game entered stoppage time -- Immobile soothed them.
Candreva once more provided the lofted assist that his grateful teammate rose to head home at the far post.