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.
1. Novak Djokovic (SRB) 16,550 points
2. Roger Federer (SUI) 7,525 (+1)
3. Andy Murray (GBR) 7,525 (-1)
4. Stan Wawrinka (SUI) 6,380
5. Rafael Nadal (ESP) 5,675
6. Kei Nishikori (JPN) 4,290
7. Jo-Wilfried Tsonga (FRA) 3,400
8. Tomas Berdych (CZE) 2,940
9. David Ferrer (ESP) 2,920
10. Milos Raonic (CAN) 2,740