Rafael Nadal was given a scare as he advanced to the final of the ATP Qatar ExxonMobil Open on Friday.
The top seed dropped the opening set 6-4 to German qualifier Peter Gojowczyk to open up the possibility of a huge upset.
But the Spaniard regained his composure and took the next two 6-2 6-3 to move into the final where he will take on Frenchman Gael Monfils.
Gojowczyk broke Nadal for an early 3-0 lead but the world number one evened things up before his opponent, ranked 161 places below him, took the set.
Two early breaks of serve had Nadal back on the front foot and, after easing to the second set, Gojowczyk's resistance was broken in a match lasting just under two hours.
"The positive thing is I am in the finals the first week of the season without arriving here with big preparation," Nadal told atpworldtour.com.
"Without playing my best, I was able to find a solution.
"It's true that I finished the match playing better than what I started. That's always a positive thing, because that means that mentally I was prepared to find solutions."
Monfils found it far easier going in the second semi-final as he overcame another German, Florian Mayer, 6-3 6-2.
The first set saw Monfils seal two breaks of serve to Mayer's one but the second was more convincing as the world number 31 sent down seven aces.