William Kvist turned a Charlie Adam free-kick into his own net to give Scotland the lead midway through the first-half, only for Ajax's Christian Eriksen to level with a swerving set-piece that caught out home keeper Allan McGregor. However, a diving header from Robert Snodgrass on the stroke of half-time proved enough to hand Craig Levein's side their first win over the Danes since 1975.
Levein was delighted to have beaten such a well-respected side, though, he admitted his team still needed to improve. "Obviously my overriding feeling is one of happiness but we have got a long, long way to go," the Scotland manager said. "We showed some really good things tonight. I think the lads did really well but I think defensively you could see we got a little bit of a run around at times."
Morten Olsen was disappointed to lose, but conceded that Scotland had shown some nice touches. "It is always an irritation to lose a football match but it was a test as we had some problems with our players," said the former Danish national captain, who has been coach for 11 years. "Scotland played some good football but I don't think they had as many chances as Denmark."
Torrential rain at Hampden meant free-flowing football was never going to be an option but Denmark, who are level on points with Norway and Portugal at the top of qualifying Group H, bossed the game early on.
Scotland's Scott Brown was given a special presentation before the match to mark his 25th cap, but he lasted just 18 minutes before hobbling off with an ankle knock following a crunching challenge from Simon Kjaer, and as Scotland looked to bring on a substitute Denmark took advantage of their extra man. Eriksen picked out Dennis Rommedahl in space in the box and he took a touch before drilling a shot off the legs of Allan McGregor.
Brown's replacement, Don Howie, made an immediate impact as he earned the free-kick which gave Scotland the lead against the run of play. Liverpool's Adam took the kick from wide on the left and his drilled effort came off the foot of Kvist on its way into the net.
However Scotland had held the lead for just nine minutes before Eriksen hauled the Danes level. McGregor left his line as he misjudged the flight of the Ajax star's free-kick from the left and the ball swerved over his head and into the far corner.
The keeper made amends in the 41st minute when he instinctively stuck out a hand to superbly stop Michael Krohn-Dehli's first time shot from Nicolai Boilesen's pass. However, Scotland got their noses in front again in the 44th minute through Snodgrass, as Miller swung the ball in from the left and the Leeds United midfielder, in his first start for Scotland, dived low to send a header past Stoke's Thomas Sorensen.
McGregor was tested straight after the break when substitute Lasse Schone's fiercely struck rising shot from 25 yards stung his palms. The waterlogged pitch at Hampden presented substitute Craig Mackail-Smith with a chance when Niki Zimling's back-pass held up in a puddle, but Sorensen blocked the Brighton striker's sliding shot.
Both sides made a host of changes but it was Denmark who appeared to cope best with McGregor having to get down low to stop a Schone strike that flew across the slick surface. Aston Villa's Barry Bannan was a late introduction and he almost caught Sorensen out with a viciously hit left-foot shot from 25 yards, as Scotland settled for victory by the odd goal.