The Doonhamers were the only team who could catch Ray McKinnon’s side and their hopes were still alive when Dale Hilson cancelled out an early opener by Kyle Benedictus, pictured.
However, Raith were not to be denied and the Fifers set up an enticing end to their season when Craig Barr smashed in the winner midway through the second half. Stark’s Park manager McKinnon said: “It’s been a long season but we have got over the line and are extremely happy.
“We showed a great will to win which we needed as we were depleted with injuries but we have winners in our side and they helped us secure this great achievement.”
Looking ahead to the play-offs McKinnon added: “We will just take what we get. We are the underdogs but little Raith Rovers have no pressure on them whereas the big clubs, Hibs and Falkirk, will have all the pressure on them.”
The Kirkcaldy side settled quickly and James Craigen was denied a goal on eight minutes when Robbie Thomson tipped his 18-yard drive over.
After the resulting corner had been nodded behind for another flag-kick, the visitors took the lead with a simple goal when Aidan Connolly whipped over the dead ball and Benedictus, who had been left all alone, headed in from six yards. Queens almost drew level on the half-hour when Gary Oliver’s effort was cleared only as far as Kyle Hutton who tried his luck with a first-time shot that flashed just wide.
Before the break visiting goalkeeper Kevin Cuthbert stretched to turn away a Darren Brownlie header with Oliver going close again.
Queens notched the equaliser they deserved on 53 minutes when Hilson got on the end of a long ball from Hutton and lashed home from 18 yards.
It almost got even better for the Dumfries men a minute later as Callum Tapping dashed clear only for Cuthbert to stick out a hand to turn away the shot.
Cuthbert kept the score level again on the hour when he palmed over a Hutton header from a Lewis Kidd free kick and it proved a crucial stop as Raith were leading again within three minutes.
Barr had seen his header from a corner cleared off the line but when the ball was played out to him again at the edge of the box he took a touch on his chest before volleying in.
Cuthbert ensured the win with a fine stop from Hilson and the Raith goal survived another late scare when Kidd sent an effort off the bar.
Disappointed home manager James Fowler said: “We created enough chances to win the game but we lost a couple of poor goals at the other end.
“Performance-wise we showed we are as good as Raith but when it came to digging out a result they were better.”