Two months after winning the Australian Open, the 35-year-old beat compatriot Stan Wawrinka 6-4 7-5 to become the oldest champion in the tournament's history, overtaking Jimmy Connors who was 31 when he won in 1984.
Having won two of the biggest titles of the season to date -- Indian Wells is considered by many to be the biggest tournament outside the majors -- Federer said he had defied even his own expectations.
"For me, the dream run continues," said the 18-time grand slam champion,
who endured six months on the sidelines at the end of last year because of injury.
"I'm not as surprised as I was in Australia, but still this comes as a big, big surprise to me, nevertheless, to win here again and beating the players that I did and the way I did. I couldn't be more happy.
"It's an absolutely huge start to the year for me. Last year I didn't win any titles. I don't think I was in any finals except Brisbane. The change is dramatic, and it feels great."
Federer moves up the rankings
In stifling 34C heat, Federer saw off Wawrinka in an hour and 20 minutes to claim a 90th career title -- 19 short of Connors' record collection.
It was a result which reduced Federer's great friend Wawrinka to tears and moved the 35-year-old Swiss to sixth in the world rankings.
He could make up further ground in the rankings over the coming weeks with world No.1 Andy Murray and No. 2 Novak Djokovic withdrawing from the forthcoming Miami Open with elbow injuries.
"I think now it's really important for me to rest up, maximum," Federer told reporters.
"I hope I can play as late as possible going to Miami. Then I will make the plan for the remainder of the season -- especially for the clay -- after Miami, and then see also what the goals are, because the goals are clearly changing after this dream start.
"I know how hard it is to win back-to-back Indian Wells and Miami titles. That's why again I sort of go to Miami knowing it's going to be really difficult."
Vesnina fights back to claim biggest career win
In the all-Russian women's final, Elena Vesnina beat Svetlana Kuznetsova 6-7 (6-8) 7-5 6-4 in a contest which lasted just over three hours.
Fourteenth seed Vesnina was a set and 4-1 down in the second set before she hauled herself back into contention, winning four games in a row to force the match into a decider.
"When I was down 4-1 in the second set, it seemed like so far away this title," she told reporters. "Now I won it and I'm so, so happy. I was playing a bit more free when I was down in the score. I took my chances."
Djokovic will not be defending his Miami title this week because of an elbow injury.
The 29-year-old said on his Facebook
page: "My doctor has strongly advised against play because my elbow injury, that I keep carrying on for months, got worse in the past week.
"Sadly, I won't be able to defend my title in Miami this week. Believe me, it is as shocking to me, as it is to you. I had [an] incredible run in Miami, I won there my first Masters tournament and started my campaign towards the top of the world rankings."