Paul Shaw rescued relegation threatened Chesterfield with his first league goal since September to boost their hopes of staying in League One.
Shaw scored three minutes after coming on for the out-of-form Colin Larkin and the result was the Spireites' first victory in nine games.
Crewe had taken an eighth minute lead through Shaun Miller, but once Aaron Downes had equalised, the home side were always on top.
This was a vital win for Chesterfield who now play one of their relegation rivals, Cheltenham, on Easter Monday and this performance will have boosted their confidence.
The passing and movement of the front players gave Crewe problems throughout the match and with better finishing they could have had the game sewn up by half-time.
Crewe lacked their usual composure on the ball although they started brightly with Miller getting behind the Chesterfield defence on their left to fire a low shot just inside Barry Roche's right-hand post.
But Chesterfield responded well to that set-back and Larkin should have done better when Jamie Ward robbed Julien Baudet and fired in a low cross which his strike partner failed to make contact with.
But Downes made no mistake in the 29th minute when Nicky Rizzo swung over a corner and the centre-half out-jumped his markers to beat Ben Williams with an unstoppable header.
The second half was dominated by the home side, although Roche had to react quickly to keep out a fierce shot from Gary Roberts in the 52nd minute, but most of the action was in the visitors' penalty area.
Rizzo was only inches away with curling shot and Crewe were struggling to cope with Chesterfield's lively forwards.
Ward in particular was a handful and in the 67th minute he played the ball in from the left and Shaw turned away from his marker to fire a low shot inside Williams' right-hand post from ten yards.
Chesterfield had some anxious moments in the closing stages, but they deservedly hung on to claim a victory that gives them a chance of avoiding the drop.