Jannik Sinner stunned Novak Djokovic as Italy beat Serbia to set up a Davis Cup final against Australia on Sunday.
Serbia took the lead in the semi-final when Miomir Kecmanovic beat Lorenzo Musetti 6-7 (7-9) 6-2 6-1 in the first singles rubber.
But Sinner showed his class to beat world number one Djokovic 6-2 2-6 7-5 and level the tie.
Sinner and Lorenzo Sonego then defeated Djokovic and Kecmanovic 6-3 6-4 in the doubles to secure a thrilling victory.
Sunday’s final will be broadcast live on BBC iPlayer and the BBC Sport website from 15:00 GMT.
What happened in Saturday’s semi-final?
An enthralling day in Malaga began with an entertaining first set between Kecmanovic and Musetti, which the swashbuckling Italian took on a tie-break.
But as the match went on, it became clear Musetti was beginning to struggle physically, and the consistent Kecmanovic took the second set comfortably before cruising through the third to put Serbia in front.
In a high-quality second singles match, world number four Sinner saved three match points to inflict a first Davis Cup defeat on Djokovic since a retirement against Juan Martin del Potro 12 years – and 21 matches – ago.
This was Djokovic and Sinner’s third meeting in 12 days after they played twice – winning one apiece – at last week’s ATP Finals in Turin.
Sinner was unplayable in the opening set as the 24-time Grand Slam champion looked uncharacteristically lost on court, but Djokovic hit back to level the match as his opponent’s level dropped.
The deciding set was filled with quality, grit and drama in a raucous atmosphere and Sinner saved three match points from 5-4 and 40-0 down, then broke Djokovic before serving out the match.
That took the tie into the doubles, and Italy looked comfortable in taking the opening set.
At one point, the crowd booed Djokovic – who had told a group of British fans to “shut up” earlier in the week – and he reacted by gesturing like a conductor.
He had no response to Sinner’s blistering groundstrokes, though, and an inspired Sonego helped take Italy to their first Davis Cup final in 25 years.
“I just tried to push in every single point and the 0-40 game helped the confidence and also after I broke him,” said Sinner. “It’s all part of tennis.”
Analysis
BBC tennis correspondent Russell Fuller
Some of the most gripping Davis Cup history has been provided by players not used to competing for major titles, but it does the competition no harm when two of the world’s top four clash on the semi-final stage.
Jannik Sinner will one day be able to tell his grandchildren he beat Novak Djokovic three times in 11 days.
Saving three match points in the singles was remarkable, as was the victory that followed two games later as Djokovic had not lost a singles tie for his country since the semi-final of 2011.
This was a fabulous effort from both men, who contested the final of the ATP Finals in Turin just six days ago.
Four hours on court will put Sinner at a disadvantage in Sunday’s final, but how Djokovic wishes he was in that position.
His disappointment will be acute – but what a season he has had. Even with two defeats to Sinner in the past fortnight he won 36 out of 39 singles matches from the start of the French Open – at 36 years of age.