Novak Djokovic fought back to beat Roger Federer in a deciding tie-break 3-6 6-3 7-6 (7-3) in the BNP Paribas Open final in Indian Wells.
The Serb, 26, lost the opening set but, despite not being at his best, clawed his way back to win the event for the third time.
Djokovic failed to serve out for the match at 5-4 in the third, but kept his nerve to comfortably win the tie-break.
It was revenge for his loss to Federer in Dubai last month.
Djokovic said: "It was a proud achievement. It was not just winning the trophy but the way I came back from a set down in a couple of matches. That gives me a lot of confidence."
A single break decided the opening two sets, but the game burst into life in a thrilling decider.
Trailing in the final set after dropping his serve in the third game, Federer broke back to keep his hopes alive.
From there, they went to a tie-breaker that was all Djokovic.
Federer sent a backhand long on the first point of the breaker and Djokovic seized a quick 3-0 lead with an overhead smash and another errant backhand from the Swiss.
Federer saved one match point with an ace, but Djokovic ended it on his first opportunity on his own serve when Federer smacked a backhand into the net.
"I said after my semi-final that very few points will decide the final - and I was right," said world number two Djokovic, who trails Federer 17-16 in head-to-head meetings.
Federer, who recruited Stefan Edberg to his coaching team at the end of last year, said: "I would have liked a few more points at the end, but Novak made it very tough.
"I'm happy and playing great tennis at the moment."
The consolation for Federer, a 17-time Grand Slam winner, is that he will rise from eighth to fifth in the world.