The Scot played well in Spain, but by failing to successfully defend his title, he drops below Federer ahead of the Italian Open this week.
Djokovic, an 11-time major champion, retains his massive lead on his closest challengers at the top of the rankings after claiming a record 29th Masters title.
Australian youngster Nick Kyrgios moves back into the top 20 thanks to his run to the quarter-finals in Madrid.
ATP top 20:
- Novak Djokovic (SRB) 16,550 pts
- Roger Federer (SUI) 7,525 (+1)
- Andy Murray (GBR) 7,525 (-1)
- Stan Wawrinka (SUI) 6,380
- Rafael Nadal (ESP) 5,675
- Kei Nishikori (JPN) 4,290
- Jo-Wilfried Tsonga (FRA) 3,400
- Tomas Berdych (CZE) 2,940
- David Ferrer (ESP) 2,920
- Milos Raonic (CAN) 2,740
- Marin Cilic (CRO) 2,725
- Richard Gasquet (FRA) 2,680
- David Goffin (BEL) 2,570
- Gael Monfils (FRA) 2,460 (+1)
- Dominic Thiem (AUT) 2,340 (-1)
- John Isner (USA) 2,100
- Roberto Bautista Agut (ESP) 2,015
- Gilles Simon (FRA) 1,945
- Kevin Anderson (RSA) 1,840
- Nick Kyrgios (AUS) 1,795 (+1)