Roger Federer will head for Miami in a positive frame of mind despite having had his 11-match winning streak ended by Novak ­Djokovic in the final of the BNP ­Paribas Open in Indian Wells.

The Swiss went into the encounter as the man in form but it was Djokovic who conquered his own doubts to win 3-6 6-3 7-6 (7-3). Federer had beaten his rival two weeks earlier on his way to the title in Dubai and had hoped to repeat the double he managed the last time he won back-to-back tournaments in 2012.

Although it was not to be, Federer was happy he had managed to maintain his form at such a high level, putting his struggles of last season even further behind him. The 32-year-old said: "I'm very happy. I think I'm playing really good tennis. I'm moving well, serving well, consistently well. So many things are working. I'm just surprised that I'm able to keep it up week after week now. I expected myself to have a breakthrough tournament, but then maybe a couple of early exits. Who knows, maybe that's all [still to come].

"Overall I'm just happy I'm playing consistent tennis and I'm going deep in tournaments and I'm giving myself chances to win. I got very, very close, so it's encouraging for Miami and for the rest of the season."

His run in the Californian desert lifted him back to No.5 in the rankings, from No.8, and he has world No.4 David Ferrer firmly in his sights. His countryman Stanislas Wawrinka is not too far ahead either, although Djokovic and world No.1 Rafael Nadal will take a lot of catching.

"It [being No.1] would be a big deal but being No.4 or No.3; that's not a big deal," Federer said. "It might help the seedings and the draws but, other than that, just right now, to think too far ahead will be a mistake.

"A few weeks ago, months ago, a few people said I couldn't play tennis any more. I need to make sure I keep a good schedule and enjoy it. At the same time, that fire, wanting to win, is important and right now I have it."