Maurice Edu scored a dramatic last-gasp goal to send Rangers into the last 16 of the Europa League, where they will meet PSV Eindhoven, as Sporting Lisbon crashed out of the competition following a 2-2 draw at the Jose Alvalade Stadium.
El-Hadji Diouf claimed his first goal for Rangers before strikes from Pedro Mendes and Yannick Djalo appeared to have secured victory for the home side.
But Edu pounced in injury time with the decisive goal in the tie as Rangers triumphed on away goals after the first leg had ended 1-1.
Sporting dominated early on, but Rangers surged into the lead with 20 minutes gone when Steven Davis raced on to a Richard Foster ball down the right flank before picking out Diouf for a header at the back post.
The hosts levelled three minutes before half-time as David Weir failed to clear an Evaldo ball into the box, which bounced off Kyle Bartley and fell for Helder Postiga who set up former Rangers midfielder Mendes to rifle past Allan McGregor.
Djalo converted a Joao Pereira cross with seven minutes remaining to put Sporting ahead, but Edu had the final say as he stabbed home substitute David Healy's cross at the death.