Novak Djokovic breathed a huge sigh of relief after pulling out all stops to deny Daniil Medvedev and lead Serbia into the final of the inaugural ATP Cup.
Thrilling Sydney's Serbian fans for the second day in a row, Djokovic outlasted Medvedev 6-1 5-7 6-4 in a two-hour, 47-minute slugfest to give his team an unbeatable 2-0 lead in the opening semi-final.
Dusan Lajovic had upset world No. 17 Karen Khachanov 7-5 7-6 (7-1) in Saturday's opening singles rubber at Ken Rosewall Arena.
Runner-up to Rafael Nadal at last year's US Open and unbeaten in his four singles rubbers this week, Medvedev threw everything at Djokovic.
He had the world No. 2 repeatedly doubling over and gasping for air after a series of long-busting baseline duels.
But, not for the first time in his distinguished career, Djokovic had the answer, the 16-time grand slam champion breaking the world No.5 for a fifth time in the fifth game of the deciding set.
He needed to fend off three break points from Medvedev in the final game, though, before finally prevailing on his second match point.
"It was very exhausting," a mightily relieved Djokovic said, having obliterated a racquet during a second-set tantrum while trying to find a way through the Russian's defences.
"It was a big battle all the way to the last shot. Daniil Medvedev is one of the best players in the world and, today, he showed why.
"It seems he's a machine. I feel the same when I'm in lockdown, so it was very physical battle. Some amazing points, obviously.
"Definitely one of the most-exciting matches I have played against him or any other top player last few years."
Djokovic hasn't played a pre-Australian Open tournament down under in a decade, preferring to spend his summer trying to peak for the season-opening major that he has won a record seven times.
But the 32-year-old said he made an exception this year for the honour of representing his country.
"And especially at this stage of my career, grand slams are the ones. And ATP Cup, Davis Cup, I love playing for Serbia and for my country, and team competitions is something that gets me going tremendously," he said.
But the gruelling workload of five singles and one doubles match over the past seven days -- plus at least one more in Sunday night's final -- has forced Djokovic out of next week's revamped Adelaide International.
"I was hoping there was going to be this many matches and this much intensity, because that means we would do well," he said.
"And we have done well and we have reached the finals.
"I did sign in for Adelaide because I didn't know how ATP Cup is going to go for us.
"So you could have also finished it pretty early after group stages, and you want to have more matches coming into Melbourne.
"We got so far here that I just need to conserve energy after this competition is done for Melbourne."
Djokovic's victory levelled his career series with Medvedev at 3-3, after he'd lost the past two, and set up a final on Sunday night for Serbia against Spain or Australia.
Led by world No. 1 Nadal, Davis Cup champions Spain play Australia on Saturday night in the second semi-final.
Nadal faces Australian No. 1 Alex de Minaur, after Roberto Bautista Agut plays Nick Kyrgios in the opening singles rubber.