Livingston moved above Raith Rovers into fourth place in Division One after Craig Barr's second-half strike secured a entertaining victory.
The home side took the lead just before the half-hour mark as Marc McNulty found Iain Russell in the area and the striker slotted into the bottom corner.
But they were pegged back five minutes later as David Smith's corner caused chaos and Brian Graham was on hand to poke home from close range.
Graham was denied a second in the 38th minute as his drive from the edge of the area hit the crossbar.
Four minutes after the break Livingston struck as Jesus Garcia Tena's cross from the left was turned in by Barr from six yards.
Douglas Hill headed over from close range in the 62nd minute as Rovers failed to find a leveller.
Livingston: McNeil, McCann, Barr, Garcia Tena, Booth (Kyle Jacobs 70), Andreu, O'Brien, Fox, Scougall, McNulty (Mullen 84), Iain Russell (Morton 64). Subs Not Used: Jamieson, Fordyce.
Booked: Booth. Goals: Iain Russell 29, Barr 49.
Raith Rovers: McGurn, Thomson, Mensing, Hill, Malone, Grant Anderson, Walker, Stuart Anderson (Hamill 80),Smith, Graham, Clarke (Spence 68). Subs Not Used: Laidlaw, Ellis, Donaldson.
Booked: Hill, Stuart Anderson. Goals: Graham 34.
Ref: Bobby Madden