Tom Naylor gave the Spireites the lead after half an hour but Trey Ogunsuyi equalised in first-half added-time with a header.
Shrewsbury went in front with 20 minutes remaining when an error from Zach Hemming allowed Ogunsuyi to force home but substitute Tom Pearce levelled with a stunning curling free-kick on 85 minutes.
But there was one more twist when Sam Stubbs headed in on the 93rd minute to pinch the three points for the visitors.
The result is damaging for Chesterfield’s promotion hopes as they fall out of the play-offs.
Here are our player ratings from the game...

1. Zach Hemming 4
Zach Hemming 4 Forced into an early save, tipping away from Boyle's long-range effort. No chance with Ogunsuyi's bullet header. But it was his individual error that led to Shrewsbury going in front, with his heavy touch allowing Ogunsuyi to nip in. He's saved Chesterfield plenty of times this season but he will want to forget this one. Photo: Tina Jenner

2. Sam Curtis 7
Sam Curtis 7 Supported attacks with driving runs, tackled and blocked crosses. A fully committed performance. Photo: Brian Eyre

3. Kyle McFadzean 6
Kyle McFadzean 6 Strong in the air and was calm in possession. With Shrewsbury sat so deep he was allowed to venture forward and he almost played as another midfielder. Photo: Brian Eyre

4. Sil Swinkels 6
Sil Swinkels 6 Had to deal with a lot of long balls in the air, which he did calmly. Stood up to the physical challenge. Photo: Tina Jenner

