Rangers made hard work of overcoming an Aberdeen side who could easily have won this game if they had taken their early chances.
Steve Lovell put the visitors ahead before Christian Dailly's first goal for the Gers brought the sides level.
An early goal by Charlie Adam at the start of the second half put Rangers ahead, but it was only when Kris Boyd forced the ball home six minutes from time, after Derek Soutar saved his penalty, that Rangers could relax.
This victory maintained the Ibrox side's four-point lead over Celtic at the top of the table.
Rangers started the match brightly with Barry Ferguson twice going close before Chris Maguire's deflected shot troubled Allan McGregor.
The Rangers keeper did well to block Lovell's shot after the Aberdeen striker had gone past Carlos Cuellar. Lovell again had a chance to put the visitors ahead, but he delayed his shot too long and Kirk Broadfoot blocked his effort.
Adam went close for the home side when his chip from 20 yards came back off the face of the bar. Lovell's flick found Barry Nicholson ten yards from goal, but his volley was turned behind by McGregor.
Aberdeen took the lead from the resulting corner. Jeffrey de Visscher's cross was flicked on at the near post by Lee Miller for Lovell to head home from close range.
Shortly afterwards Lovell's pass released de Visscher, who outpaced David Weir only to see McGregor parry away his shot.
Aberdeen were made to pay for their profligacy in front of goal when Rangers equalised, as Dailly sidefooted home Adam's inswinging corner at the near post.
With Nacho Novo on after half-time for the ineffectual Chris Burke, Rangers started to dominate and it was no surprise when they took the lead. A curling cross from Broadfoot was headed home at the back post by Adam.
Rangers chased that vital third goal and Novo went so close with a 20-yard shot which came back off the post.
It was Novo who won the penalty near the end after Alan Maybury brought him down. Soutar did well diving to his left to keep out Boyd's penalty kick, but the striker forced home the rebound from six yards.