Roger Federer (left) and Rafael Nadal (right) share a laugh at the 2017 ATP Shanghai Rolex Masters. Getty

The biggest upset of the tennis season has caused a shakeup in the top rankings. Rafael Nadal, who has not played a match since Jan. 23, will overtake Roger Federer for the No. 1 ranking on April 2 after the Swiss superstar was knocked out of the Miami Open on Saturday.

Federer, who entered the match after losing in the Indian Wells final to Juan Martin del Potro, seemed poised to cruise through the Round of 64 but faced a fierce comeback from 21-year-old Thanasi Kokkinakis. Federer captured the first set, but the No. 175-ranked Australian fought back to shock the tournament's defending champion, 3-6 6-3 7-6.

Kokkinakis' win marked the biggest upset against a No. 1 player since 2003, when then-No. 178 Francisco Clavet defeated Lleyton Hewitt.

The defeat means Federer will lose 990 ATP points. Nadal will have 8,770 points by next week and will own a slim 100-point advantage over Federer. Marin Cilic is a distant No. 3.

It will mark the fifth time that Nadal has sat atop the ATP rankings.

The Spaniard is still recovering from a leg injury but is expected to compete in clay-court tournaments in April and ahead of the French Open. Nadal is seeking an unprecedented 11th title at Roland Garros.

Federer, meanwhile, will skip the clay-court season, including the French.

Thanasi Kokkinakis (left) is congratulated by Roger Federer (right) at the Miami Open. Getty