Rangers kept their advantage at the top of the SPL with a strong finish at East End Park.
Late goals from Lorenzo Amoruso and substitute Claudio Caniggia finally killed off a Dunfermline side who posed them problems throughout.
Indeed, had Steve Crawford not missed in front of goal near the end, Dunfermline could have snatched a point, but Caniggia sealed the win when he headed home a Neil McCann cross moments later.
It was a cruel finish for Dunfermline who had swept forward in numbers after Craig Brewster equalised early in the second half.
Dunfermline, chasing their first-ever Premierleague win over Rangers, made a positive start and Brewster hooked an overhead kick wide of Stefan Klos' left-hand post inside the first minute.
Brewster was then denied by a superb instinctive save by the Rangers goalkeeper. Barry Nicholson drove into the penalty area and his cutback was met by Brewster, whose first-time shot looked bound for the net until Klos leapt across his goal to get a hand to the ball.
Rangers took time to threaten but Shota Arveladze should have put them ahead in the 28th minute after a through ball from Amoruso, but Derek Stillie did well to deflect his shot for a corner.
Two minutes later, Noel Hunt created a chance for Crawford at the other end but the striker's 16-yard shot was too high.
Rangers took the lead eight minutes from the break when Stillie misjudged a McCann corner in the wind and the ball finished in the back of his net.
Dunfermline equalised in 49 minutes when Klos blocked a shot from the lively Hunt but Brewster steered home the loose ball.
Rangers were back in front in the 71st minute when Mikel Arteta touched a free-kick into the path of Amoruso and his thunderous shot left Stillie helpless.
Then came Crawford's miss in the 89th minute when he scooped the ball over from just six yards and Caniggia then sealed the victory.