Spurs were drawn in Group H alongside the Spanish giants, German side Borussia Dortmund and Apoel of Cyprus.
The draw pits the Premier League runners-up against Wales winger Gareth Bale, who left Spurs for Real in a world record deal in 2013 and will be coming up against his old club for the first time.
Scottish champions Celtic face a tough test in a group with Bayern Munich, Paris St-Germain and Anderlecht.
Premier League champions Chelsea have been drawn to play Atletico Madrid, Roma and Qarabag in Group C, and Europa League winners Manchester United face Benfica, Basel and CSKA Moscow in Group A.
Manchester City, who finished third in the Premier League last season, are up against Shakhtar Donetsk, Napoli and Feyenoord in Group F, while Liverpool, who beat Hoffenheim in a play-off to secure their place in the draw in Monaco, will meet Spartak Moscow, Sevilla and Maribor in Group E.
The group stages begin on 12-13 September.
Five English clubs are contesting the group stage of a Champions League campaign for the first time.
The last time six British teams qualified for the group stages was in 2007-08, when English sides Manchester United, Chelsea, Liverpool and Arsenal were joined by Scottish clubs Celtic and Rangers. The final saw Sir Alex Ferguson's United defeat Avram Grant's Chelsea on penalties.
Groups at a glance
Group A: Benfica, Manchester United, Basel, CSKA Moscow
Group B: Bayern Munich, Paris St-Germain, Anderlecht, Celtic
Group C: Chelsea, Atletico Madrid, Roma, Qarabag
Group D: Juventus, Barcelona, Olympiakos, Sporting
Group E: Spartak Moscow, Sevilla, Liverpool, Maribor
Group F: Shakhtar Donetsk, Manchester City, Napoli, Feyenoord
Group G: Monaco, Porto, Besiktas, RB Leipzig
Group H: Real Madrid, Borussia Dortmund, Tottenham, Apoel
When are the group stage match days?
Match day one: 12-13 September
Match day two: 26-27 September
Match day three: 17-18 October
Match day four: 31 October-1 November
Match day five: 21-22 November
Match day six: 5-6 December