ISTANBUL (AP) -- Real Madrid reached the Champions League semifinals for the third straight season on Tuesday despite losing 3-2 at Galatasaray following a second-half resurgence by the Turkish team.
Madrid needed a double from Cristiano Ronaldo to advance 5-3 on aggregate, but only after conceding three goals in a 16-minute span to raise Galatasaray's hopes of pulling off what would have been a remarkable comeback.
Ronaldo looked to have wrapped up the quarterfinal series by scoring in the seventh minute for a 4-0 overall lead, requiring Galatasaray to score at least five goals to advance.
The Portugal forward scored again in stoppage time for his 48th goal - including a competition-high 11 in the Champions League - in 47 matches this season. But only after Galatasaray came alive following Emmanuel Eboue's 57th-minute leveler.
Galatasaray forward Wesley Sneijder scored in the 71st, before Didier Drogba added another goal a minute later. Both previously played under Madrid coach Jose Mourinho - Sneijder at Inter Milan, Drogba at Chelsea.
Madrid was hanging on at this stage as the crowd, whipped up into a fervor, urged Galatasaray on.
"During a few minutes, the tie was open when it shouldn't have been after we had gone ahead,'' said Mourinho. "But when they play with this passion, and not just with 11 but with 50,000, anything is possible.''
Madrid right back Alvaro Arbeloa was sent off in injury time after being booked twice.
Also on Tuesday, Borussia Dortmund beat Malaga 3-2 to win their quarterfinal.
It will be Madrid's 24th semifinal appearance in Europe's top-tier club competition, although the team has been eliminated at that stage the past two years. It will be the fourth straight year Mourinho has reached the final four, having led Inter to the title in 2010.
Madrid completely dominated the match until Eboue's equalizer, which awakened Galatasaray's attack and transformed the match from a placid stroll to a frantic contest largely staged in Madrid's last third.
"We're happy for the classification, mission complete,'' Ronaldo said. "This match will serve as an example for us in the future. In football you cannot just give chances away. It was our own fault that the game almost got out of hand.''
Ronaldo opened last week's first leg with a goal in the ninth minute to set Madrid on course, and he bettered that by two minutes Tuesday as the nine-time winners search for their first European Cup since 2002.
Making a tough challenge even more difficult, Galatasaray was without suspended top-scorer Burak Yilmaz, responsible for eight of the team's 11 goals in the tournament. But after a tepid first half, veterans Sneijder and Drogba proved they were worth their winter signings.
Madrid is feared for its deadly pace and firepower on the break, but its opening goal was a product of a passing combination, helped by Galatasaray's porous defense.
Ronaldo slipped along the six yard box, just staying onside to expertly redirect Sami Khedira's cross into the far side of the net with his right foot after Mesut Oezil had played his fellow Germany midfielder clear on the side.
Ronaldo almost set up a second goal in the 24th when his nifty back-heeled pass left Angel Di Maria unmarked in the area, only for goalkeeper Fernando Muslera to palm the rising shot and send it high and wide.
Ronaldo looked sure to double Madrid's advantage in the 57th but uncharacteristically stumbled and sent Di Maria's pass by the post with Muslera beaten.
Seconds later, Eboue equalized with a blistering blast from the edge of the area into the top corner of the net following a pass by Sneijder.
The goal ignited the crowd and Madrid's nerves started fraying. Madrid defender Fabio Coentrao came close to gifting Sneijder a goal when his poor clearance across his own area gave the Netherlands midfielder a golden chance, but he angled his strike wide.
Sneijder made up for his miss with a beautiful touch to tap a pass beyond Raphael Varane, rounding the defender before slotting the ball home.
Drogba, who had until then been little trouble for Madrid's defense, expertly flicked in Nordin Amrabat's low cross with the back of his right heel while facing away from goal and fending off Varane to send the home fans wild.
"Our halftime team talk was on the desire not to lose the game and this brought the victory,'' Galatasaray coach Fatih Terim said. "After the third goal, we started to dream about the semifinals.''
Galatasaray pushed for another goal - needing two more at that time due to Madrid's away goal - but the visitors soaked up the pressure.
Ronaldo polished off his team's qualification to the next round three minutes into injury time by converting substitute Karim Benzema's pass.
"Maybe we could not knock Real Madrid out of the competition but I think we deserve the respect of the whole world,'' Terim said. "We need to keep our heads high.''