When the draw was made on Friday, Murray, seeded second, landed in the opposite half to the star pair, who are on course to meet in the semi-finals of the Masters 1000 tournament.
In the absence of world No 1 Novak Djokovic, Federer is the top seed and Nadal, who has slipped down to fourth in the ATP rankings, is seeded third.
Murray will open his campaign against either German Philipp Kohlschreiber, with whom he had an epic battle on clay at last year’s French Open, or a qualifier.
The seeds in Murray’s path to the semi-finals are Gael Monfils and Milos Raonic, while Kei Nishikori is the man seeded to face the former Wimbledon champion in the last four. The Japanese star won last week’s event in Barcelona but also has David Ferrer in his quarter.
Before any semi-final with Nadal, Federer could have to get through John Isner and Tomas Berdych – both tricky opponents on the red dirt.
Nadal’s quarter looks easier, which will be music to the ears of the Spaniard who has been struggling for form of late. Stan Wawrinka is the man seeded to meet Nadal in the quarter-finals.
Nadal will open his bid for a fifth Madrid title (a fourth since it became a clay-court event) against American Steve Johnson or a qualifier. Federer’s first foe will be either Australia’s big hope Nick Kyrgios or a qualifier.
The men’s main draw gets under way on Sunday, with the women’s tournament starting 24 hours earlier.
In that, Serena Williams is the top seed and has been placed on course to meet her elder sister Venus in the last 16, plus Wimbledon champion Petra Kvitova in the semi-finals.
In the opposite half of the draw, Maria Sharapova and Simona Halep are seeded to meet in the last four. That match would be a repeat of last year’s classic French Open final which was won by Sharapova.
Sharapova could face British No 1 Heather Watson in round two. The Briton will first have to beat a qualifier.