Los Blancos looked set to cruise through when Cristiano Ronaldo opened up a four-goal lead in the opening minutes, but a timid response by the visitors encouraged the Turkish giants to chase the impossible, which they almost achieved as Emmanuel Eboue, Wesley Sneijder and Didier Drogba hit in the second half.
Ronaldo finally ended their hopes with a late goal that sealed victory.
Virtually assured of a place in the Champions League semifinals thanks to a dominant 3-0 win in the Santiago Bernabeu, Real Madrid still began the second leg in belligerent fashion, pushing forward immediately in search of a goal.
Angel Di Maria was almost the man to provide it in the first minute of play, picking up a loose ball after Fernando Muslera's rushed clearance outside the area. The Argentine went for the net, but with Galatasaray defenders scampering back he saw the effort fall just the wrong side of the post.
Away fans, however, did not have to wait long, as after just seven minutes of play the Merengue got the strike that would surely put the tie beyond the faintest of doubts.
An overlapping Sami Khedira streaked past on the right-hand side, and put a teasing ball into the middle. As the Turkish backline failed to react, Ronaldo was on hand to gleefully tap home, recording his 49th Champions League goal and drawing level with the legendary Alfredo Di Stefano in the historical charts.
Despite that early blow, Galatasaray held its head high, dominating possession against Jose Mourinho's men and attempting to match its rivals. Drogba was the target of much of the Turks' attacking play, but was let down by poor service and his own fading reflexes, and struggled to make an impact. Madrid sat back and was content to allow its opponents to do the running, while on the counterattack it remained a frightening force.
This potency on the break was demonstrated when Di Maria went within a hair's breadth of adding a second. The midfielder latched to a wonderful flick from Ronaldo to break free on the left, and looked destined to put his name on the board. He did not count on the heroics of Muslera, however, as the goalkeeper pulled off a breathtaking fingertip save to keep Angel out, and ensure that the gap would not widen as the two sides went in for the break.
The Turkish side continued its unlikely pursuit in the second half, and was rewarded with its first goal of the tie 57 minutes in - and it was one worth waiting for.
A speculative ball across the Madrid area was not picked up by anyone, which allowed Eboue to meet it just on the edge of the area. The right back had been disappointing during the opening hour, but atoned with a stunning power shot which left Lopez no chance to save, and put Galatasaray on the board.
The hosts were now buoyant, and could have reduced the deficit to 'just' three goals if Sneijder had converted a golden chance. The Netherlands star found himself in the right place at the back post after a low cross was deflected into his path but, gloriously unmarked, he fluffed a left-footed shot to save Madrid from falling behind on the night.
The midfielder was not done, however, Cutting inside his marker from deep, Sneijder went to to release a bullet of a shot that put his side ahead, at least for the second leg.
The Turkish crowd, from a position of despair, could not believe their eyes. Drogba set up an unthinkable last 20 minutes with a wonderful backheel into the net, putting Galatasaray up 3-1 and leaving just two goals for the comeback.
Drogba thought he had leveled the tie before being pulled back for an offside and Madrid lived to breathe another day, with Ronaldo confirming his team's passage with a strong finish in the final minute.
The Merengue join Borussia Dortmund in the penultimate stage of the competition with Juventus, Bayern Munich, Barcelona and Paris Saint-Germain fighting to claim the final two spots on Wednesday evening.