Juan Martin Del Potro, once one of tennis' hottest young talents before his career was derailed by injuries, won the Indian Wells Masters two years after nearly quitting in frustration.
Del Potro arrived in the Californian desert on the back of a title win in Acapulco but had far from a smooth ride against an agitated Federer, who simply would not give up on his quest for a sixth Indian Wells title.
"After all my problems, after all my surgeries, I couldn't believe I'm here winning a Masters 1000 and beating Roger".
Much like Del Potro in the men's final, Osaka, who had thrashed Romanian world number one Simona Halep in the semi-finals, took the first set comfortably in just 39 minutes. I have everything what I want, and I want to keep improving my game to see what can I do.
When asked what he expected of himself for the remainder of 2018, he said: "I don't know, I'm just going my way and I'm very pleased with my level of tennis. I'm doing this because I love it", said the 29-year-old.
He also handed Federer his first loss of the year, snapping the Swiss superstar's 17-match winning streak that was the best of his career.
The 2018 Miami Open is the 34 edition of the men's and women's tennis tournament that will be played between March 19 and April 1.
Service holds came fast and rather easily at first, but, with del Potro serving at 4-4, Federer worked things to deuce, and broke with a short backhand that del Potro could not dig out.
"I should have lost a match", Federer said.
After slipping outside the world's top 400, Del Potro returned to the top five in 2013 but another wrist injury meant more surgery and led him to miss the majority of the 2014 and 2015 season.
The second set was even tighter and at times sprinkled with the kind of quality that graced matches between the pair a decade ago.
With Federer 40-15 up on serve and leading 5-4 having broken Del Potro in the previous game, it was again the Argentine's huge forehand which began dictating the points, leveling the score at deuce.
The Argentine seized the opening set and had a match point in the second set tie break but misfired on a forehand - usually his most dependable weapon - to allow the 36-year-old Swiss back into the match.
Federer managed to win the second set but lost the third, meaning he surrendered his Indian Wells crown to Del Potro. "Goalkeepers. Federer. Leg speed, yes, but not reaction time". And I still had a good week here. "I am excited to see what is next". "Juan Martin was a bit better at the end".
In a battle of 20-year-olds, Japan's Naomi Osaka claimed her first career title with a commanding 6-3, 6-2 victory over Russian Daria Kasatkina.