Thiago Alcantara struck twice on Thursday (AEDT) and Robert Lewandowski, Arjen Robben and substitute Thomas Mueller were also on target as the Bavarians, struggling for form recently, inflicted Arsenal's first defeat of the season in Europe's premier club competition.
Alexis Sanchez had equalised for the visitors, scoring on the rebound after Manuel Neuer saved his 30th-minute penalty.
The sides meet for the second leg in London on March 8.
Casermiro wonder goal puts Real in control
Casemiro's stunning volley crowned a superb display from Real Madrid, who fought back to beat Napoli 3-1 at the Bernabeu in the first leg of their tie.
The Brazilian midfielder thundered a spectacular effort into the net early in the second half to complete Real's comeback, adding to efforts either side of halftime from Karim Benzema and Toni Kroos.
Napoli, the top scorers in Serie A, grabbed an early goal when Lorenzo Insigne spotted Real keeper Keylor Navas out of position to curl the ball home from distance.
Holders Real, who are chasing a 12th European title, will travel to Naples for the return leg on March 8.
Real were defending an enviable home record in the Champions League, having gone 11 games undefeated at the Bernabeu, but were facing a Napoli side in form, unbeaten in their last 18 matches in all competitions.
Real, eyeing a seventh straight quarter-final appearance, were at the throats of their opponents within moments of the kickoff as Benzema forced a reflex save from Pepe Reina with barely 20 seconds on the clock.
At that point it looked like it could be a long evening for Napoli, but the Italians were in no mood to lie down and took the lead to cap a frenetic opening after eight minutes.
Insigne was fed through on goal by Marek Hamsik and spotted Real keeper Navas out of position. Quick as a flash and with two defenders closing in, he bent a shot into the corner from 35 metres.
The lead lasted 10 minutes as Real drew level when Dani Carvajal's arrowed cross was headed powerfully into the net by Benzema.
The remainder of the half was spent mainly in Napoli territory as Real continued to press, with Cristiano Ronaldo blasting over after being set free by Luka Modric and Benzema clipping the outside of the post when through on goal.
Their dominance, however, was rewarded four minutes after the restart as Ronaldo skipped to the byline and pulled it back for Kroos on the edge of the box to sidefoot calmly past Reina.
Four minutes later Casemiro took the game, and perhaps the tie, away from Napoli with a stunning right-foot volley from 25 metres that left Reina flailing.