Novak Djokovic of Serbia reacts during the match. Photograph:( AFP )
It is the second time Roberto Bautista Agut has beaten Djokovic in his career and both victories occurred in a semi-final.
Novak Djokovic lost surprisingly in Doha on Friday, beaten in the Qatar Open semi-final by world number 24, Roberto Bautista Agut, 6-3, 6-7 (8/6), 6-4.
The Serb fell to his first defeat of the season in a high-quality contest lasting more than two-and-a-half hours, which saw the Spaniard lose his first set of the week but come back to beat the world number one.
"What happened? I lost the match. That's it," a clearly frustrated Djokovic said in his post-match press conference.
Agut took Djokovic's serve in the second game of the final set for the decisive break and secured victory on his first match point.
"I will remember this match for [the rest] of my life," said the 30-year-old Spaniard.
He will play the Czech Republic's Tomas Berdych in Saturday's final.
"I can't be more happy than I am now."
It is the second time he has beaten Djokovic in his career and both victories occurred in a semi-final.
The first came in October 2016 in Shanghai. Djokovic was also world number one at that stage.
Bautista Agut said Friday's victory was the better of the two.
"I think today the match was better, the level of the tennis today was very high," he said.
"We both played very good tennis and it was also more tight on the score and more emotions and today was a really good match."
A fired-up Djokovic smashed his racquet after dropping his serve in the eighth game of the second set.
"I thought I was pretty much in control of the match, set and a break, serving 4-3," Djokovic said.
"He played a good game. I missed some easy balls and that's what you get as a result of losing the focus in the most important moments and it happens, it happens."
Questions may be asked about how tired the Serb was, as he played two matches each day for three days in singles and doubles, prior to Friday's defeat.
Including the meeting with Bautista Agut, Djokovic spent almost 10 hours on court in three days and played 11 sets in singles' matches.
Asked if he had done too much through the week, he replied: "I wasn't the freshest, you know.
"This is what I was looking forward to, to get from this tournament, as many matches as possible, to get ready for the Australian Open, so I'm very pleased.
"Obviously, I'm not pleased that I lost the match today, but I lost to a better player in the end."
The second semi-final proved a much tamer affair.
Berdych eased through to his second Doha final in straight sets, beating Italy's Marco Cecchinato 7-6 (8/6), 6-3.
Currently the world number 73, Berdych was once ranked number four.
His previous Qatar Open final, in 2015, was also against a Spaniard, David Ferrer. It ended in a straight sets defeat.