Match ends, St. Johnstone 1, Rangers 2.
Alfredo Morelos scored a late winner as Rangers came from behind to beat St Johnstone and move within a point of Scottish Premiership leaders Celtic.
The Colombia striker took his tally for the season to 19 with just two minutes to play, volleying in James Tavernier's teasing delivery.
It earned Steven Gerrard's side a fourth win in a row at McDiarmid Park.
Morelos' downward header from a Glenn Middleton cross had cancelled out Matty Kennedy's thunderous first-half opener.
This was the first time in six games the Ibrox side had scored more than once, with the second-half introductions of Middleton and Kyle Lafferty swinging the game in Rangers' favour.
A win would have moved St Johnstone into fifth place, but a second consecutive defeat after an eight-game unbeaten run instead leaves the Perth side eighth.
Jekyll and Hyde Rangers
For all the praise Rangers have received under Gerrard - and having recently topped the table - they arrived in Perth having only won one of their past five games, scoring twice.
A lack of creativity from central midfield has been a problem and, with Ovie Ejaria returning to Liverpool, their resources were further stretched by the absence of Scott Arfield and Ryan Jack. It showed.
St Johnstone manager Tommy Wright decided to crowd that area, with two midfielders starting in place of two forwards and Kennedy playing as a lone striker - hardly surprising considering they had shipped seven goals in their past two games against the visitors.
The plan could have been undone within four minutes had Andy Halliday not side-footed wide after stealing in, and Joe Worrall and Morelos went close as Rangers saw more of the ball.
However, St Johnstone were growing into the game, with Murray Davidson lofting a shot just over, and Liam Craig should have done better than head wide from close range. That swelling confidence was fuelled by the tendency of Rangers' two centre-backs to cheaply concede possession.
Minutes after Lee Wallace replaced the injured Borna Barisic to make just his second appearance in 15 months, the left-back went missing as Kennedy gathered a cross in plenty of space at the back post, turned inside flailing Rangers bodies and fired his sixth goal of the season high into the net.
Gerrard threw on winger Middleton and striker Lafferty after the break, and it was the former who supplied the cross that found Morelos stealing between two defenders to head his 18th goal of the campaign.
The Jekyll and Hyde nature of Rangers contributed to an exciting finale. Their defensive frailties were exposed with a Kennedy drive curling just wide and Allan McGregor having to beat away a Blair Alston drive. Meanwhile, their potent attack came to life as Zander Clark saved well from Daniel Candeias, Lafferty and Morelos.
Contrasting fortunes within a matter of seconds decided the game. Alston headed just over from a Richard Foster cross after an incisive break and Rangers raced up the other end, with Morelos finishing after being picked out by Tavernier.
Rangers players and management had gone into the game talking about targeting a three-game winning run finish to the year. They remain on course, but to earn victories over Hibernian and Celtic they will have to address their deficiencies after coming so close to falling at the first hurdle.
'Lafferty & Morelos make difference' - analysis
BBC Scotland's Brian McLauchlin at McDiarmid Park
Wright set out his stall from the outset, with Kennedy given the unenviable task of lone striker against the substantially taller and more physical Rangers defence. His work-rate, however, was phenomenal and he deserved his goal and the standing ovation he received when he was replaced.
St Johnstone will play worse and win games and they should also head into the latter part of the campaign with a positive outlook.
Credit though has to be given to Gerrard. The Rangers boss' decision to send on Lafferty just 10 minutes into the second half was the turning point of the match. Until then, the Ibrox outfit looked laboured.
Morelos, though, scored two of the most clinical finishes you will see. His value to the Ibrox club is immense and, if Rangers are to maintain the pressure on Celtic into the second half of the season, he will be required to maintain his scoring rate.
'We were awful. I let them know' - reaction
St Johnstone manager Tommy Wright: "We haven't defended two crosses, so the manner of the goals are disappointing, but not the manner of the performance.
"I can't praise them highly enough. We were controlled and had the balance right throughout the game between defence and attack. That's the standard they have to maintain."
Rangers manager Steven Gerrard: "Glenn Middleton was excellent and gave us an assist, a fantastic ball. And Kyle Lafferty was a constant thorn in their side and could have had a couple himself.
"From the first day of the season until now, Alfredo [Morelos] been incredible for us and you've seen the quality today quite clear - two top-class finishes."
- 4AlstonBooked at 87mins
- 26CraigBooked at 54mins
- 10WotherspoonSubstituted forWattat 74'minutesBooked at 90mins
- 33KennedySubstituted forSwansonat 81'minutes
- 6GoldsonBooked at 62mins
- 31BarisicSubstituted forWallaceat 41'minutes
- 23CoulibalySubstituted forLaffertyat 56'minutes
- 35GrezdaSubstituted forMiddletonat 45'minutes
- 20MorelosBooked at 89mins
- Nick Walsh
- Shots on Target
Second Half ends, St. Johnstone 1, Rangers 2.
Connor Goldson (Rangers) wins a free kick in the attacking half.
Foul by Danny Swanson (St. Johnstone).
Tony Watt (St. Johnstone) is shown the yellow card for a bad foul.
Connor Goldson (Rangers) wins a free kick in the attacking half.
Foul by Tony Watt (St. Johnstone).
Attempt missed. Jason Kerr (St. Johnstone) header from the centre of the box misses to the right.
Attempt missed. Ross Callachan (St. Johnstone) right footed shot from outside the box is high and wide to the left.
Alfredo Morelos (Rangers) is shown the yellow card for excessive celebration.
Goal! St. Johnstone 1, Rangers 2. Alfredo Morelos (Rangers) right footed shot from the centre of the box to the top right corner. Assisted by James Tavernier with a cross.
Attempt missed. Blair Alston (St. Johnstone) header from the centre of the box is just a bit too high following a fast break.
Attempt blocked. Andy Halliday (Rangers) left footed shot from outside the box is blocked.
Blair Alston (St. Johnstone) is shown the yellow card for a bad foul.
Andy Halliday (Rangers) wins a free kick in the attacking half.
Foul by Blair Alston (St. Johnstone).
Corner, Rangers. Conceded by Zander Clark.
Attempt saved. Kyle Lafferty (Rangers) right footed shot from the right side of the six yard box is saved in the bottom right corner.
Delay in match Danny Swanson (St. Johnstone) because of an injury.
Corner, Rangers. Conceded by Joe Shaughnessy.