Boyd scored twice late on to ensure Rangers' victory in Inverness
Two goals from Kris Boyd ensured a win over Inverness that lifted Rangers to within five points of leaders Celtic.
It had been Caley Thistle, sitting bottom of the Scottish Premier League, who created the better chances of a rather subdued first half.
Keeper Allan McGregor beat away an Iain Vigurs header and a Don Cowie drive.
But Mendes curled a stunning 22-yard strike into the top corner, Boyd broke clear to fire in the second and then rose to head home the third.
Rangers eventually took advantage of reigning champions Celtic's Saturday slip-up against Dundee United, but it took Mendes' moment of magic to rouse them out of a strange lethargy.
Nacho Novo, boosted by a double for a Galician select against Iran last weekend, had returned to the Glasgow side's starting line-up, with Charlie Adam dropping out of the squad after winning a rare appearance in the defeat by leaders Celtic.
And the little Spaniard was obviously brimming with confidence when he tried a 50-yard chip that might have had goalkeeper Ryan Esson in trouble had it not drifted a few feet over the crossbar.
Rangers manager Walter Smith will have been hoping that Madjid Bougherra return from injury to central defence - Steven Whittaker dropped to the bench - would have rid his side of the vulnerability that has been evident in recent weeks.
But, despite the visitors' early midfield dominance, it was Inverness who forced the first save of the match.
Roy McBain, who had been moved from central midfield to wide right to make way for fit-again Hearts-bound Ian Black, whipped in a dangerous cross and goalkeeper Allan McGregor managed to beat away Vigurs' header from point-blank range.
Vigurs had come into midfield along with Black - with Dougie Imrie and Garry Wood dropping to the bench - in what appeared to be a more defensive line-up.
But the home side again caused panic in the Rangers rearguard when McGregor was unable to hold Cowie's powerful 18-yard snap shot before being hastily cleared.
Mendes scored a minute into the second half at Caledonian Stadium
Vigurs again threatened with a 20-yard effort that had the beating of the goalkeeper but flew into the side netting.
And, shortly after Cowie broke clear but fired wide after rounding McGregor wide on the left, the half-time whistle was greeted by a chorus of boos from the disgruntled Rangers support.
Whatever was said at half-time by the Rangers management team appeared to work, with Mendes collecting a back-heel from Steven Davis and curling the ball superbly into the far top corner from 22 yards seconds after the break.
Caley Thistle defender Ross Tokely forced his own goalkeeper into a save as his interception of a low Mendes cross turned into a powerfully misdirected pass-back-cum-shot.
Davis fired a volley just over the crossbar from 18 yards, Novo forced Esson into a good save from a powerful long-range effort and substitute Chris Burke sent a low drive just wide as Caley Thistle started finding it difficult to properly clear their lines.
Andrew Barrowman came close to an equaliser with a snap shot from the edge of the box that was beaten away by McGregor.
But, moments later, Davis put Boyd clear with a clever through-ball and the striker's low drive with nine minutes remaining ensured a victory that was vital to Rangers' title hopes.
And there was still time for Boyd to head home a Burke cross from close range as Caley Thistle suffered their sixth straight defeat.
Inverness Caley Thistle manager Craig Brewster:
"I thought our performance was excellent in the first half.
"We were up on things, we were in about Rangers and we were creating chances.
"And I still don't know why Iain Vigurs one did not go in.
"I told the players at half-time that the first five minutes were vital - then there's a world class finish from a world class player.
"When you lose a goal like that, it is always going to be difficult, but we battled away for an hour."
Rangers manager Walter Smith:
"After starting well for the first 15 minutes, our performance went very flat for half an hour.
"For all territorially we had most of it, they had a couple of good chances
"But we had a terrific start to the second half with a great goal from Pedro Mendes and the performance after that was much better.
"After the goal, Caley had to come at us a bit and that created more opportunities for us."
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.