(CNN) -- It took him two hours and nine minutes, but Roger Federer eventually saw off the challenge of world No. 48 Radek Stepanek to reach the third round of the Dubai Duty Free Championship.
Seventeen-time grand slam champion Federer found himself 0- 2 down in the third and deciding set against a player he had beaten 12 times in their previous 14 matches.
The Swiss rallied, winning five straight games to take the match 6-2 6-7(4-7) 6-3 and set up a tie against Stepanek's compatriot Lukas Rosol.
"I started to understand what I was doing wrong which made me maybe play a little bit tentatively from the baseline, what made me not make enough shots [and] why I wasn't playing as aggressively as I wanted to," the 32-year-old told the ATP Tour's official website.
"I couldn't find the right balance between offense and defense. It was almost a bit too late for everything, but I kind of hung around and I took the positives out of the match."
Federer is a five-time former winner of this event and the world No. 8 says coming through such a tough match will stand him in good stead for the rest of the competition.
"Radek did a good job of putting the pressure on me and mixing it up," added Federer. "From that standpoint, it was a really difficult match. I'm very pleased to come through."
Federer, who looking for his second tournament win of 2014 following his success at January's Brisbane International, is on course for a semifinal meeting with Novak Djokovic.
The Serb is looking to win the Aviation Club title for the fifth time and he is already into the last four after Russia's Mikhail Youzhny withdrew from their last eight tie through illness.
If the top seed records a victory in his semifinal, it will be the 550th win of his career.
Djokovic recruited six-time grand slam champion Boris Becker to his coaching staff in December, a decision he says is already paying dividends.
"Whatever he's trying to work on he discusses with all of us, and, of course, we all have a big respect for Boris," said Djokovic.
"I'm really glad that he's in the team, and I feel like he can contribute in a positive way to my game and to my mental approach on the court."