The event is to raise money for the Realmadrid Foundation and the Rafa Nadal Foundation, which both use sport as a tool to encourage social integration.
It is hoped the chance to see the top two players in the world in action will attract a crowd in excess of 80,000 people, and it will be a particularly special occasion for Nadal, who is a passionate Real Madrid fan.
A statement on the Real Madrid website read: "The pitch at the Santiago Bernabeu Stadium will turn into a tennis court on 14 July for a charity match between Rafa Nadal and Novak Djokovic.
"It will be organised by the Realmadrid Foundation and the Rafa Nadal Foundation, hoping to gather a record 80,000+ crowd and collect proceeds for projects developed by both foundations."
Djokovic and Nadal were the finalists in this year's first Grand Slam in Australia. Serbian Djokovic prevailed 5-7 6-4 6-2 6-7 (5-7) 7-5 in an epic contest lasting five hours and 53 minutes, making it the longest final in Grand Slam history.