Federer, the world No. 1 who hadn't lost a set here until Saturday, when Croatia's Borna Coric extended him to three sets, lost the first and had to outlast Del Potro to win a second-set tiebreaker, 10-8.
Federer broke for a chance to serve for the match at 4-4 in the third set, but del Potro wouldn't go away, saving three match points during Federer's 5-4 service game.
"I can not believe I won this tournament, beating Roger in a great final and level of tennis", Del Potro said. "I'm surprising myself every day, and I want to keep surprising the tennis tour", del Potro said post-match.
Del Potro lost just six points on his serve in the first set.
The injury-prone big man has beaten Federer in seven of 25 attempts, including a famous triumph in the 2009 US Open final, but he has found it hard to reach those levels in recent years due to troubles with his body.More news: Children with Down's Syndrome take part in special Carpool Karaoke
Federer had to save a championship point after some superb, quick serves from Del Potro and then finally closed out the set on his fifth attempt. In the end I was lucky to win. "I can see why he caused a lot of problems to a lot of players, and he's only going to improve from here". The 36-year-old was 17-0 in 2018 - his best ever start to a season - and was seeking his third title of the year having won the Australian Open and the Rotterdam Open.
The Argentine stunned a raucous Indian Wells crowd that had been loudly backing Federer to continue his winning streak and secure the biggest win in the nine years since his US Open title triumph with a 6-4 6-7 (8) 7-6 (2) victory.
Osaka, ranked 44th in the world, completed her sweep through Indian Wells with a 6-3, 6-2 women's singles victory over fellow 20 year old Daria Kasatkina. "It was tough for me to keep fighting (after losing MP in the second)".
He added: "That's why retirement can wait, and I'm just really enjoying the ride". It is one of my favourite tournaments on tour. "I mean, we played a great level of tennis". Despite earning a match point Del Potro failed to close out the match in straight sets.
Del Potro's latest win, though, was his most significant yet.More news: Amazon said to be weighing up Toys R Us store buys
"I have to get over it". Let's not forget that he's one of the very few to have attained a Grand Slam title during the reign of Federer-Nadal-Djokovic-Murray, the 2009 U.S. Open win over, you guessed it, Federer.
"I'm still shaking I'm so nervous", del Potro told ESPN.
An annoyed Federer barked at the umpire during a changeover and, fired up by his grievance, took the second set to even up the contest before pushing del Potro to the limits in the final stanza. He's also a great volleyer - I'm surprised he doesn't come to the net more the way he reads balls and makes instinctive plays at the net.
And despite not being as high as Federer in the ATP rankings, Rusedski believes Del Potro has the better comeback story.
"It's awesome for our sport and for the life so thank you very much".More news: Record-breaker Salah hits four as Liverpool crush Watford