Rangers will take a 3-1 lead to Slovenia next week after a late Lassana Coulibaly goal secured a convincing Europa League win over Maribor.
Alfredo Morelos' tap in after six minutes had the hosts ahead in the third qualifying round tie.
But, just a minute after Morelos had a second flagged offside, Mitja Viler's stunning volley levelled.
James Tavernier restored Rangers' lead from the spot before Coulibaly struck with four minutes to play.
Whoever prevails in Slovenia next Thursday will face either Russian side FC Ufa or Progres Niederkorn, who knocked out Rangers last year.
The Russians will take a 2-1 lead to Luxembourg for the second leg.
Colombian striker Morelos only lasted 12 minutes before being sent off against Aberdeen on Sunday, although that decision was overturned on Wednesday.
But it took him just six minutes for him to make a positive impact on this tie, showing great instinct to be in the right place at the right time to put Rangers in the lead.
However, Morelos was in the wrong place at the right time after 39 minutes as he turned the ball into the net, only for it to be flagged for offside. It appeared to be the right call.
Unlike at Pittodrie, the 22-year-old didn't let his frustrations get the better of him as he put in a powerful shift in the second half that helped drive Rangers into a commanding lead.
It was his touch and turn that drew the foul from Sasa Ivkovic to allow Tavernier to convert from the spot.
And, even for the third, Jamie Murphy's floated cross just missed the head of the Colombian before Coulibaly - possibly with the use of his upper arm - doubled Rangers' advantage.
Manager Steven Gerrard will not overlook how much of a fright Maribor gave Rangers in the first half, though.
Viler's leveller was something to behold but, aside from that, Allan McGregor and Tavernier were both called into action to prevent the Slovenians from scoring.
However, if Rangers play like they did in the second half, they should have more than enough to get through to the play-off round.