Goals from Gareth Bale and Alvaro Morata book ended strikes from Marcelo, Marco Asensio and Lucas Vasquez, but not before a Miroslav Radovic penalty gave the 11-time European Champion a brief scare.
"Today we were more offensive, but defensively we suffered a bit more," Real manager Zinedine Zidane told reporters after the match. "Other than that I'm happy.
"We are always looking to improve -- the balance of the team was not perfect at times. Today we played a more attacking XI, so there were more risks.
"They didn't really have many chances and we were able to counter-attack easily. Cristiano may not have scored today, but he assisted with goals & that's all I'm concerned about."
Despite Real's early dominance, it was Legia which almost took the unlikeliest of leads after 12 minutes.
Guilherme deceived Marcelo with several silky stepovers and found Vadis Odjidja-Ofoe on the edge of the box, but his shot hit the inside of the post with Keylor Navas well beaten.
But less than a minute later, Real took the lead. Gareth Bale cut inside onto his favored left foot and drilled a low shot into the far corner.
The second quickly followed, Karim Benzema teed up Marcelo on the edge of the area and his shot took a heavy deflection off Jakub Czerwinski, completely deceiving Arkadiusz Malarz in the Legia goal.
The Polish side conceded six at home to Borussia Dortmund in the opening Champions League match day and with two quickfire goals, Real had its own European Cup record 8-0 win in its sights.
However, just a minute later, Legia had the chance to get back into the game from the penalty spot.
Danilo's clumsy challenge brought down Radovic, who got up, dusted himself down and coolly sent Navas the wrong way.
That was the first Champions League goal Navas had conceded at the Bernabeu, while it marked 21 years to the day since Legia last scored in the competition.
The visiting side's joy was short lived, however, as Cristiano Ronaldo set up Asensio to calmly slot the ball low to Malarz's left.
Morata's cross set up Vazquez for the fourth, before Ronaldo turned provider for a second time to assist Morata for Real's fifth.
This was the third time this season Los Blacos have scored five or more in a game, an ominous sign for this weekend's opponents, Athletic Bilbao.
In Lyon, Juventus goalkeeper Gianluigi Buffon had arguably the best performance of his stellar 21-year career.
Affectionately dubbed 'Superman' by his own fans, Buffon was met with a banner at the weekend that read: "Even Superman is 'just' Clark Kent sometimes... Gigi always our superhero," in reference to his error against Spain.
At Lyon's Parc Olympique, a first-half penalty stop was followed by a quite breathtaking reaction save, before Juan Cuadrado's goal earned the 10-man side an undeserved three points.
Lyon, now four points behind 2015 finalist Juventus in Group H, will be ruing a profligate night in front of goal.
"We recovered after the red card but we weren't good enough 11 vs. 11," Buffon said after the match. "We still have plenty of room to improve."
Meanwhile in Real's group, Borussia Dortmund had to see off a spirited late charge to hold onto a 2-1 win against Sporting in Lisbon.
Pierre-Emerick Aubameyang blitzed past Ruben Semedo with his trademark searing pace and impudently dinked the ball over Rui Patricio after nine minutes.
Julian Weigl doubled the German's lead two minutes before half time, tiptoeing past two challenges and firing a low strike into the bottom corner.
An indirect free-kick allowed Bruno Cesar to halve the deficit but Dortmund's victory ensures it remains ahead of Real Madrid on goal difference.
In Russia, Lacina Troare opened the scoring for CSKA Moscow against Monaco, the club he is currently on loan from.
But spare a thought for CSKA goalkeeper Igor Akinfeev. With just three minutes to go, it looked as though the 30-year-old would finally keep his first Champions League clean sheet in 39 games, a run stretching nearly 10 years.
However, a later Bernardo Silva goal ensured Akinfeev's decade-long wait for a clean sheet goes on, as Monaco stole yet another late point.
Premier League champion Leicester City's 1-0 win against Danish side FC Copenhagen saw it accumulate more points in its three Champions League games that it has managed in eight Premier League games this season.
Jamie Vardy's deep cross was headed back across goal by Islam Slimani and Riyad Mahrez stabbed home his third European goal of the season to go level at the top of the scoring charts.