Chesterfield's Tom Naylor headed the only goal to spring a big shock by dumping his former club Portsmouth out of the FA Cup.
Midfielder Naylor, who spent three seasons as a Pompey player, nodded in Liam Mandeville's free-kick to clinch victory for the National League leaders over the team at the top of League One.
The home side, managed by ex-Portsmouth boss Paul Cook, were good value for their win and could have added to Naylor's first-half strike.
It was a first defeat for Pompey in any competition since March.
The Spireites made their intent clear within seconds of the kick-off, with Will Grigg quick to charge down a clearance from Portsmouth goalkeeper Will Norris, but the ball rebounded to safety.
Ollie Banks might have done better with a couple of efforts from distance, while Pompey responded with a sweeping crossfield move that ended with Harry Tyrer turning Paddy Lane's low attempt around the post.
But Chesterfield broke the deadlock when Mandeville whipped in a free-kick for Naylor - who had scored in each of their last two home games - to head his side in front and extend his goalscoring run.
The visitors were also forced to make early changes, with defender Regan Poole limping off before an apparent hamstring strain accounted for Tino Anjorin, who had looked dangerous during the first half.
Fuelled with confidence, Chesterfield dominated after the interval and the lively Michael Jacobs almost doubled their advantage, cutting in from the flank for a left-foot strike that deflected and spun over the bar.
Portsmouth's only real sniff of an equaliser came midway through the second period when Lane delivered a cross on to the head of substitute Abu Kamara, only for his glancing effort to trickle wide.
The home side might have made the contest safe as Darren Oldaker set up Ryan Colclough, who stabbed his finish into the side netting, while James Berry was denied at close range by Norris.
But, although Pompey staged a brief rally in the closing stages, Chesterfield - who knocked out two EFL sides en route to the third round last season - held out to secure a memorable victory.