Dunfermline leapfrogged Raith to move second in the Scottish Championship table after a 4-1 win at East End Park.
The Pars, who had been winless in their previous four league games, moved within nine points of leaders Hearts.
Dunfermline took the lead on the stroke of half-time. Iain Wilson’s crossfield ball picked out Declan McManus who made no mistake in finishing past Jamie MacDonald.
The hosts doubled their advantage six minutes after the break when Aaron Comrie’s strike from the right side found the far corner via the post.
Raith reduced the deficit after 64 minutes when Brad Spencer’s long-range strike picked out the top corner.
But Dunfermline hit straight back two minutes later as Fraser Murray’s free-kick secured the win, before the midfielder struck again three minutes from time.