Poul Hubertz came off the bench to rescue three points for Millwall after they did their best to throw away what seemed a certain win over Chesterfield.
The home side looked intent on keeping up their recent good run from the off and the visitors were straight on the back foot.
So it was no surprise when Millwall took lead after just ten minutes when Darren Byfield did well to stretch and meet a Marvin Elliott cross with his head and guide it into the corner.
It was the striker's 11th goal of the season and he was a constant threat in a sharp-looking attack alongside Marvin Williams.
And Byfield was only inches away from doubling his tally seven minutes later when he cut in from the left and hit a right-foot shot which brushed the side-netting as it went wide.
Chesterfield, on the other hand, offered little in attack. Little Jamie Ward was making his full debut after his £100,000 move from Torquay but was often left isolated.
Any problems Millwall looked like having were going to be created by themselves, with goalkeeper Lenny Pidgeley flapping at a cross halfway through the first half.
So it looked like a comfortable lead for the Lions going into the break and they could have doubled it soon after.
Williams got clear on the right and decided to square the ball instead of shoot when he got into the box. Byfield was running on to it but was bundled over by Kyle Critchell.
Somehow, referee Grant Hegley was not interested in awarding what seemed a blatant penalty.
And matters were made worse for Millwall just over ten minutes later. Paul Hall had been introduced for the Spireites at half-time in place of the ineffective Colin Larkin and he had an immediate impact.
Marcus Phillips failed to clear a left-wing cross and the former Jamaica international slammed the ball into the roof of the net as it fell to him on the edge of the box.
Then Hubertz was introduced along with winger Chris Hackett in a managerial masterstroke by Millwall boss Willie Donachie on 73 minutes.
The game was looking like it could still go either way until five minutes from time when Hackett received the ball on the right and swung in a pinpoint cross which the big Dane headed home for the three points and his seventh goal of the season.