Raul netted a brace for Real while Ruud van Nistelrooy also got on the scoresheet as Madrid, jeered off the pitch following dismal home performances recently, claimed a narrow first leg win at the Bernabeu.
Bayern, for whom the Champions League is their last realistic chance of silverware this season, netted their valuable goals through Lucio and Mark van Bommel two minutes from time, to leave everything up for grabs in the second leg.
Neither side came into the match in the best of form domestically, with Madrid having been held at home by Real Betis at the weekend and Bayern going down 1-0 at struggling Aachen.
Madrid coach Capello, who Spanish media had claimed handed in his resignation on Monday — something dismissed by the club’s board — opted for a more attacking line-up than usual.
He started with two strikers in van Nistelrooy and Gonzalo Higuain, brought the evergreen Roberto Carlos in at left-back and dropped holding midfielder Emerson to the bench.
Bayern coach Ottmar Hitzfeld, who has lost two of his three games since replacing Felix Magath, named Owen Hargreaves in his first XI after the England international sat out the Aachen loss.
Madrid knew they needed to get the Bernabeu crowd onside quickly, and did just that when Raul opened the scoring after only 10 minutes.
Van Nistelrooy picked up a pass from David Beckham before threading a superb ball through to Raul, who bundled his way past Oliver Kahn and slotted into an empty net.
Madrid were not ahead for long though, as Bayern equalised with their first real chance of the game in the 23rd minute.
A deep free-kick to the far post from Willy Sagnol found the unmarked Lucio and he headed home past Iker Casillas.
That could have dented Madrid’s confidence, but instead of going into their shells, the home side promptly went back down the other end and re-took the lead only a few minutes later.
Beckham flung in a corner and Ivan Helguera rose highest in the box to send a looping header back across goal which Raul got the slightest of touches on to nod home from point-blank range.
The impressive Beckham, who was sent off against Betis at the weekend, was leading the Madrid charge and he was again involved as the Spanish side made it 3-1 in the 34th minute through van Nistelrooy.
The former England captain drilled in a free-kick which found its way through to van Nistelrooy at the far post and the unmarked Dutchman made no mistake from about four yards out.
Bayern, who are already out of the German Cup and are a massive 12 points behind leaders Schalke in the Bundesliga, tried to stage an immediate reply but Roy Makaay’s volley was straight at Casillas as Madrid finished the first half two goals clear.
The interval did not seem to break Madrid’s stride either, and they twice went close to extending their lead in the opening five minutes of the second half.
Firstly Higuain shot straight at Kahn after latching onto a brilliantly-weighted Beckham through ball, before Beckham himself brought a flying one-handed save out of the Bayern goalkeeper with a curling 25-yard free-kick.
With their Champions League hopes drifting away, Bayern started to push men forward after that, and substitute Claudio Pizarro was only denied a goal by a superb stop by Casillas low down to his left.
The German visitors controlled possession for the final quarter of the game but aside from another Pizarro effort, which Casillas parried away, they looked unlikely to make a second breakthrough.
But that was until two minutes from the end when Van Bommel latched onto a loose ball on the edge of the Madrid area to power a shot into the bottom corner of Casillas’ net, cutting the difference to one goal and leaving the tie on a knife-edge heading into the return encounter in Munich.