Dunfermline started the game well and could have taken the lead when David Graham broke through on goal only to see his shot cannon off the post, before Buchanan’s effort from the rebound was saved by Allan McGregor.
But the Pars were celebrating on 16 minutes when Paddy Boyle’s cross from the left flank found Andy Kirk at the back post to slot home.
Just eight minutes later, Rangers equalised when a Maurice Edu shot was blocked by Pars keeper Chris Smith, but striker David Healy latched onto the loose ball and hit the back of the net.
Rangers upped their pressure on the Dunfermline back line and it paid dividends just six minutes before the break when Davis fired a free kick into the box, Carlos Bocanegra teed up the ball for the makeshift striker Lee McCulloch to score his first goal of the season.
Into the second half and McCulloch should have scored his second of the game when he met a Healy cross but headed over the bar. On 70 minutes Rangers stretched their lead to 3-1 when midfielder Sone Aluko got on the end of a pass from McCulloch to score from 25 yards out.
Aluko then denied Dunfermline a goal when he headed an Alex Keddie shot off the line. With five minutes remaining substitute Salim Kerkar rounded off the scoring when he fired low past Smith to make it 4-1.
Dunfermline: Chris Smith, Jordan McMillan, Patrick Boyle, Alex Keddie, Kevin Rutkiewicz, Gary Mason (Joe Cardle, 76), Mark Kerr (Martin Hardie, 65), Paul Burns, Liam Buchanan (Ryan Thomson, 74), Andy Kirk, David Graham
Rangers: Allan McGregor, Carlos Bocanegra, Kyle Bartley (Kirk Broadfoot, 63), Dorin Goian, Sasa Papac (Salim Kerkar, 84), Lee Wallace, Lee McCulloch, Sone Aluko, Maurice Edu, Steven Davis, David Healy (Mervan Celik, 63)
Referee: Brian Winter