Kyle Benedictus headed home inside eight minutes but it proved a half of few chances thereafter.
The hosts levelled when Dale Hilson rifled home after a good turn, but Craig Barr restored Raith's lead.
Rovers are four points behind third-placed Hibernian, who have two games in hand.
Promotion play-off qualifiers Raith Rovers extended their unbeaten Scottish Championship run to eight games with victory at Queen of the South.