The world No 2 had cruised into the last eight but was taken the distance by Jo-Wilfried Tsonga before coming through 7-6 (12/10) 6-1 3-6 4-6 6-1 after three hours and 53 minutes.
Murray has made a habit of fighting back from two sets down but this time it was Tsonga threatening to do the improbable.
Yet Murray has only ever lost once having won the first two sets and, after telling his box he was not going to lose this one, he delivered superbly to set up a last-four clash with Tomas Berdych.
Murray said: “Obviously it was a tough match. The end of the fourth set was really tough.
“I tried to use all my energy at the beginning of the fifth set to get myself up and get the crowd pumped up.
“Thankfully I got the early break and I hung on to it.”
Asked about letting his lead be whittled away, Murray said on BBC One: “Tsonga’s a pretty good player, he’s not bad, he’s one of the best grass-court players in the world. He came up with some great shots.
“He started returning better and mixed it up well. Credit to him for fighting his way back into the match.
“He fought really hard until the end.”
Murray was thrilled with the way he handled the decider, and added: “I’m happy I’m through to the semis, it’s time to go and rest and get ready for the next one.”
Earlier in the day, Roger Federer came back from the brink to edge a five-set thriller against Marin Cilic, keeping his hopes of an 18th grand slam title alive.
Federer saved three match points and battled back from two sets down on Centre Court to beat Cilic 6-7 (4/7) 4-6 6-3 7-6 (11/9) 6-3 in the contest of the tournament so far.
It means Federer has reached a record-equalling 11th semi-final at the All England Club and he will play Canada’s Milos Raonic for a place in Sunday’s showpiece match.