Maurice Edu's stoppage-time goal sent Rangers into the last 16 of the Europa League in a thrilling finish in Lisbon.
Rangers took the lead after 20 minutes when El Hadji Diouf's downward header from Steven Davis' cross found the net.
Sporting levelled after 42 minutes when Rangers failed to clear a cross into the penalty box and Pedro Mendes curled it in against his former club.
Yannick Djalo was left unmarked to head the 82nd-minute winner, but Edu stabbed home to ensure an away-goals victory.
Rangers had reverted to their European formation with three central defenders, with captain David Weir at its heart after overcoming illness and Richard Foster at right-back.
John Fleck was a surprise choice on the left of midfield, with the versatile Steven Whittaker in an unusual central midfield role and Davis on the right.
Sporting adopted an attacking formation, with full-back Abel being replaced by midfielder Cristiano Oliveira from the first leg.
Matias Fernandez, who scored in the first leg as a substitute, started in midfield ahead of the man he replaced in that game, Maniche, while Marco Torsiglieri replaced the suspended Daniel Carrico in central defence.
And Rangers were soon under pressure as they displayed their recent inability to hold on to possession.
Indeed, Whittaker was robbed by Djalo 25 yards from his own goal and the Sporting midfielder's low drive was beaten away for a corner by goalkeeper Allan McGregor.
Sporting took encouragement from Rangers' uncertainty and won a series of corners, but the Scots survived without too many nervous moments.
Walter Smith's side worked their way into the game and began to probe for openings up front, where Diouf had been preferred to Kyle Lafferty after the Northern Irishman profligacy in the first leg.
And, when Foster prodded the ball forward for Davis, the midfielder's cross to the back post found the Senegal forward peeling off his marker and headed back across goalkeeper Rui Patricio and into the empty net.
Rangers were looking increasingly comfortable, with an off-target long-range effort from Mendes being their only real threat.
However, just as it looked like the visitors would survive until half-time, a mix-up in defence let former Ibrox man Mendes to equalise.
David Weir decided late not to head away a cross ball, the ball deflected off the startled Bartley and, when Helder Postiga played the ball back to Mendes at the edge of the box, the Portugal midfielder curled the ball beautifully into the corner.
Diouf was involved in a head-to-head argument with Sporting defender Evaldo as the half-time whistle blew, the players being separated by the fourth official and Rangers coach Kenny McDowell.
It was the Lisbon side who looked fired up as the second half began and McGregor had rise smartly to palm clear a curling Fernandez cross that would have crept in at the back post had the goalkeeper not conceded the first of three corners within the first eight minutes.
Sporting should have taken the lead when a chipped pass from Fernandez found Joao Pereira sneaking in behind the Rangers defence, but he headed over from eight yards.
The game was now flowing from end to end and, when a Davis header was saved by Rui Patricio, Sporting broke clear and McGregor had to block a low Pereira drive clear with his legs.
Rangers boss Smith made a surprise change after 71 minutes, withdrawing Weir, with Vladimir Weiss and Kyle Lafferty coming on for the veteran defender and the largely anonymous youngster, Fleck.
Davis sent a 20-yard drive curling wide of the near post as the visitors adopted a more adventurous formation.
However, when Sasa Papac was dispossessed on the touchline, Pereira's cross found Djalo at the back post and he headed powerfully past McGregor from 10 yards.
It looked like Sporting's run of six games without a victory was coming to an end until Foster played in David Healy and the substitute's cross across the face of goal was touched in by Edu from close range.