Novak Djokovic admitted he was pushed to the limit by Alexander Zverev but his hopes of a ninth Australian Open title remain alive.
The world number one has been fighting through the pain barrier at Melbourne Park since sustaining an abdominal injury during his third-round win against Taylor Fritz.
After somehow winning a fifth set in that one, he struggled to a four-set victory over Milos Raonic in round four and he was forced to dig deep into his well of competitive fire to pull out a 6-7 (6) 6-2 6-4 7-6 (6) success against Zverev.
"Down to the very last shot it was anybody's match," said Djokovic, who has never lost when he has reached the last four in Melbourne.
"A lot of nerves out there, a lot of pressure. Emotionally I feel a little bit drained. It was a great battle. We pushed each other to the limit."
Djokovic began slowly but retrieved a break of serve only to lose the first-set tie-break. He responded brilliantly but was down in both the third and fourth sets and saved a set point to avoid being taken to a decider before edging another tie-break.
One turning point came when the Serbian obliterated his racket after failing to take a break point in the fifth game of the third set, subsequently winning five games in a row.
He said: "It was a relief for me but I wouldn't recommend this kind of relief channelling, if you want to call it. Of course, I'm not proud of these kind of moments.
"You go through a lot of different emotions. You go through a lot of inner battles, and everyone is different. I have my own demons that I have to fight with."
The good news was that Djokovic, who has not been practising on his days off, looked physically a lot better than he had against Fritz or Raonic.
He said: "The positive thing is that I actually felt the best today from the beginning of the second set until the end of the match that I have since the third round against Fritz when the injury happened.
"It means that this is going in the right direction, and fingers crossed that in two days it will stay the same."
Defeat was a bitter pill to swallow for Zverev, who has become a consistent performer at the grand slams over the past couple of seasons and was left to rue chances not taken.
He said: "For me, the most upsetting parts in the third and fourth sets were actually not losing my serve but not getting the second breaks. Because I had chances in both those sets being up 4-0 or 5-1 that would have changed things, I think, a lot.
"It was a great match. I think we both played well. But I'm definitely not happy with the result."
In the semi-finals, Djokovic will face qualifier Aslan Karatsev, who became the first male grand slam debutant in the Open era to reach the semi-finals at a major after beating an injured Grigor Dimitrov 2-6 6-4 6-1 6-2.
Dimitrov won the first set but became increasingly hampered by a back spasm and during the third and fourth sets was struggling to serve and move around the court.
Karatsev, a 27-year-old Russian, has plied his trade in the lower reaches of the sport for his whole career, never breaking into the top 100, only to come through qualifying and storm through the draw at Melbourne Park.
He will now be ranked inside the top 50, and he said of his remarkable breakthrough: "Of course I'm thinking about if it will happen. Of course it's amazing that I passed to semi-final from qualifying.
"I'm just trying to enjoy the moment and not thinking about that too much and playing from round to round."
A rueful Dimitrov said of his back spasm: "It started (on Monday) out of the blue. It was just a regular movement. Just super unlucky.
"I felt great over all the past days. I felt I was on a good path. We've done great work. I couldn't put my socks on before the match, so I knew it was going to be a tough moment for me. I tried, but it was not good enough."