Glynn Hurst struck a priceless late winner to earn Chesterfield a dramatic last day reprieve from relegation.
The striker pounced two minutes from time for the only goal of the game just when it seemed Roy McFarland's men were heading to Division Three.
Top scorer Hurst latched onto a long goal-kick that was flicked on by Ian Evatt and toe-poked the ball past Luton keeper Dean Brill.
The Spireites went into the game knowing they had to win to have a chance of staying up. But, despite plenty of pressure, they created few scoring opportunities before Hurst's strike.
David Reeves almost gave the home side a dream start when his drive from the edge of the area was deflected inches wide after just 40 seconds.
Then, 11 minutes later, Brill dived full length to keep out a 25-yard free-kick from Allan O'Hare.
And nine minutes from time, Evatt had a header cleared off the line as it seemed it wouldn't be Chesterfield's day.
But Hurst's winner coupled with defeats for Rushden & Diamonds and Grimsby Town ensured the Spireites will be playing second division football again next season.
After the celebrations had died down, McFarland said: "The players gave me, the supporters, and the Football Club everything today. I couldn't ask any more from them.
"There was a fair chance we would be relegated but now it feels like a promotion.
"The lads kept their discipline and it took a long time coming but we thought Lady Luck might just have a final twist. And fortunately she did.
"It's been an excellent day and I'm delighted for everyone connected with the club." Luton, missing top scorer Steve Howard, rarely threatened Carl Muggleton's goal.
And after the game their manager, Mike Newell, said: "We knew it would be difficult as Chesterfield were fighting for their lives. But I am happy with our performance.
"We showed plenty of commitment and desire. We just let ourselves down at the end. It sums up our season really."