Accrington Stanley were again punished for defensive mistakes as Chesterfield came back from two goals down to claim an impressive victory that boosts their play-off chances.
But the visitors gave them a helping hand with some chaotic defending and they also had six players booked and manager John Coleman sent from the dugout late in the game for shouting at a linesman.
It had looked so much more promising for the Lancashire club when Andrew Procter put them into a two-goal lead midway through the first half.
He opened the scoring in the 23rd minute when a header came back off the crossbar and then put away a penalty on the half-hour after Shaun Whalley had been brought down.
But Chesterfield hit back straight away when Derek Niven reduced the arrears with a shot from the edge of the area after a cross had only been partially cleared.
Accrington had shown some disturbing defensive uncertainty in the first half and they were punished when Mark Roberts chested a long throw past goalkeeper Kenny Arthur for the equaliser.
Within a minute, the home side were in front when substitute David Dowson saw a shot blocked and Jamie Lowry followed up to roll the ball into an empty net.
As the yellow cards were brandished by the referee, Coleman lost his temper and was sent to the stands with ten minutes remaining.
By then, his team were running out of ideas and, five minutes from time, Chesterfield clinched the points with an impressive goal.
Niven broke away on the right and played in Dowson who set up Jamie Ward to take the ball around Arthur and score the fourth goal.