The Spireites had to withstand a barrage of Swindon pressure for the majority of the first half and much of the second following Jack Lester's disallowed strike in the eighth minute.
But the npower League One side, who last graced the national stadium in 1995, held firm and went ahead through an own goal from Swindon's Oliver Risser before Craig Westcarr netted in second-half stoppage time to secure a memorable victory.
Lester had the ball in the back of the Swindon net after following up Simon Ford's attempt which rebounded off the crossbar, but saw the goal ruled out for offside.
The League Two side slowly gained the upper hand and goalkeeper Tommy Lee did well to paw Lee Holmes' deflected shot to safety.
One fine move carved Chesterfield apart in four inch-perfect passes, only for Alan Connell to volley wide when well placed inside the box.
However, the Robins' wastefulness in front of goal was punished by Chesterfield after the interval in the most fortuitous of circumstances. After Jordan Bowery's effort was saved by Wes Foderingham, Alex Mendy collected the loose ball, turned his marker and fizzed in a low centre which was prodded into his own net by Risser.
The Spireites wasted a gilt-edged chance to put the game to bed with 18 minutes remaining when Westcarr missed the target when one-on-one with Foderingham.
The Chesterfield goalkeeper then came to his team's rescue late on, producing a superb fingertip save to push Alessandro Cibocchi's header to safety.
But Chesterfield's celebrations could start in earnest in injury time when Westcarr raced clear to beat Foderingham and make it 2-0.
Source: PA
Source: PA