Roger Federer and Rafael Nadal
The world No. 1 ranking has gone back to Rafael Nadal (R) after Roger Federer's early Miami Open exit. Pictured: Winner Roger Federer of Switzerland and Rafael Nadal of Spain after the Shanghai Masters tennis tournament finals in Shanghai, China, Oct. 15, 2017. REUTERS/Aly Song

Rafael Nadal will become the world No. 1 for the fifth time in his career once the Miami Open ends this week, but what does he need to do in order to retain it before the start of the grass-court season?

The Spaniard lost his position as the top-ranked player in the world earlier this year as he remained on the sidelines due to injury while Roger Federer achieved the feat of becoming the oldest world No. 1 in tennis history en route to winning the Rotterdam Open in February.

With Nadal not taking part at Indian Wells or the Miami Open this month, it appeared as if Federer would further extend his lead in the rankings given his extraordinary unbeaten start to 2018.

However, with the 36-year-old losing to Juan Martin del Potro in the Indian Wells final along with suffering a shock round of 64 exit at the hands of Australia's Thanasi Kokkinakis, Federer not only lost 990 ranking points but was overtaken by an injured Nadal in the rankings who now holds a slim 100-point lead with 8,770 points.

Despite hints that he may feature during the clay-court season, Federer announced that he will be skipping it once again and will return in June for the grass-court season. Nadal, meanwhile, is expected to return for his favored clay events but will not have an easy task of remaining world No. 1 by the end of the clay swing.

The 31-year-old will be defending a total of 4,860 points after winning titles in Monte Carlo, Barcelona, Madrid and the French Open along with reaching the quarterfinal stage in Rome. This essentially means Nadal will have to retain trophies at every clay event that he won last year in order to remain above Federer in the rankings.

The only event in which Nadal cannot win but still remain atop the rankings is the Rome Open where if he exits in the round after his opening match, he will still hold a 10-point lead over Federer. If the 16-time Grand Slam champion emerges victorious in Rome however, he will gain an additional 820 points.

A win in the capital of Italy would also allow Nadal to become world No. 1 again if he fails to retain his title in Barcelona, but the latter happening would mean a temporary drop to number two in the rankings behind Federer.

If he wins all five of the clay-court events he takes part in, Nadal will enter the grass-court season with a 920-point lead over Federer, with the latter then defending 2,500 points after his wins in Halle and Wimbledon last year. Nadal meanwhile, just has 180 points to defend during the grass-court season after only playing at Wimbledon last year as he exited in the round of 16 stage.

The first clay-court event of the year takes place at the Monte-Carlo Masters which will commence from April 14-22. Nadal won the event last year after defeating fellow Spaniard Albert Ramos Viñolas in straight-sets.