Wimbledon 2017: Andy Murray beats Fabio Fognini in thriller
The defending champion had breezed through his opening two matches but found his future in the tournament under serious threat amid a deafening atmosphere on Centre Court.
Fognini is a fiery character and was docked a point for obscene behaviour but had five chances to force a deciding set before Murray fought back to win 6-2 4-6 6-1 7-5.
The world number one now has two days to recover before facing Frenchman Benoit Paire on Monday.
Murray had talked up the threat of Fognini, who is more comfortable on clay than grass but a talented shot-maker on any surface.
Murray won just six games in their most recent meeting in Rome in May and had lost half of their previous six matches.
Fognini was the third unpredictable opponent in a row for the world number one after Alexander Bublik and Dustin Brown.
But, with Fognini, it is less about his shots than the casual manner with which he struts round the court and his propensity to fluctuate wildly in form and focus.
The first set was a case in point, with Fognini dialled in for the first four games only for Murray to run away with it.
Fognini served consecutive double faults in the final game but then regrouped at the start of the second set and became the first player to break the Murray serve all tournament.
But the 28th seed then dropped serve himself, reacting by angrily slamming his racket to the turf, earning himself a code violation and probably a sizeable fine.
Fognini, one of the more combustible players on the tour, already owns the record for the biggest single fine in Wimbledon history after being penalised 27,500 US dollars (around £16,000 at the time) in 2014.
There was little rhythm to the match and Murray was in trouble again after a weak backhand barely halfway up the net gave Fognini another break for 3-2.
This time the Italian held onto his advantage, and Murray knew how important it was not to allow Fognini to carry momentum into the third, letting out an almighty roar when he held serve in the opening game.
The Murray limp was still in evidence but it was his opponent who now appeared to be struggling physically, with Fognini taking a medical time-out to have his right foot taped.
The set quickly went Murray’s way but Fognini got back in the game at the start of the fourth and threatened the Murray serve in the fourth game.
The world number one completely shanked a second serve to trail 0-30 but pulled back to level and, after losing the next point, Fognini responded by sucking on his finger.
It was deemed an obscene gesture by umpire Damien Dumusois and, having already been warned for abuse of his racket, Fognini was docked a point and lost the game.
He argued his case with Dumusois to no avail but the incident fired up the lively evening crowd and it was Fognini who took advantage.
A sixth Murray double fault handed Fognini the break for 4-2 and, the Scot had to save two set points in his next service game.
Fognini looked set to clinch it at 5-3 40-15 but there was more drama to come.
After Murray saved one, Fognini stopped mid-rally on the second when he thought a Murray forehand had landed long but the Italian had forgotten he had used all his challenges.
It cost him the point, and Centre Court roared when Fognini dumped a drop shot in the net to hand Murray the break back.
The defending champion saved a fifth set point to level at 5-5 and then took full advantage of Fognini’s frustration by making it four games in a row.
That left him serving for victory in the gloaming, and this time there were no more twists as Murray clinched it with his 14th ace after two hours and 39 minutes.