Chesterfield came from behind to keep their League One survival hopes alive by beating Rochdale, who were relegated as a result.
Jean Louis Akpa-Akpro stroked Dale ahead from the edge of the box.
Scott Boden poked the Spireites level from close range before Danny Whitaker drove in the winner after Franck Moussa's shot hit the bar.
Chesterfield's third successive win leaves them four points from safety with two games left.
However, their inferior goal difference to Walsall means they will realistically need to win their remaining two fixtures to survive.
VIEW FROM THE DRESSING ROOM:
Chesterfield assistant manager Tommy Wright tells BBC Radio Sheffield:
"I thought Rochdale were the better team on the day.
"But credit to the players, they showed a lot of determination and guts to keep going.
"We knew the results at half time, weren't going for us, but credit to the players and the manager.
"A couple of good subs again and both went on and scored a goal."
Rochdale manager John Coleman told BBC Radio Manchester:
"I'm devastated because we shouldn't have been beaten. We were the better team by a mile.
"Sloppy defending has cost us the game and our inability to win away from home is the reason why we've been relegated.
"I've had enough time to turn it round and enough opportunities to win enough games to stay up.
"I think we'd have stayed up if we'd have won. Two more wins would have been enough."