Sam Nicholson’s first-half strike and Soufian El Hassnoaui’s 56th-minute goal were enough to secure the points for Hearts with Calum Elliot grabbing a consolation for the visitors.
Hearts had the better of the opening period but struggled to test Kevin Cuthbert in the away goal.
Kenny Anderson fired wide before Hearts had a penalty appeal turned down by referee Willie Collum when striker El Hassnoaui went over in the box.
The home side kept pressing and finally breached the Raith defence in the 34th minute when Osman Sow flicked the ball on to Nicholson who took a touch before steadying himself and firing the ball low past Cuthbert into the net.
Hearts could have doubled their lead before the break but Sow and then El Hassnaoui were both unable to hit the target with efforts that were directed wide.
Ryan Conroy failed to put Raith on level terms when he lifted his shot over the bar at the back post before Nicholson squandered a decent chance to grab his second of the game when he fired his shot straight at the ‘keeper.
El Hassnoaui made it 2-0 11 minutes after the restart when he met Callum Paterson’s cross and drilled
the ball low past Cuthbert.
Turkish defender Alim Ozturk headed over the bar and Kevin McHattie had a shot saved as Hearts went in search of
a third goal.
But the third goal, when it came, went to Raith in the 66th minute when former Hearts player Elliot cut in from the left wing and drilled the ball past Scott Gallacher.
Jamie Walker’s volley was easily saved by Cuthbert but the winger went even closer a minute later when he was unlucky to see his effort strike the post.
Gary Oliver raced in on goal and was also denied by Cuthbert, who saved with his legs and then watched as the ball hit the post and bounced out for a corner.
Sow fired narrowly wide before Elliot almost snatched a late equaliser for Raith, but his fierce shot was kept out by a brilliant stop from home goalkeeper Gallacher and Hearts held out to secure another home win.