Goals from Luton Shelton and Michael Jakobsen sent the tie all the way, after a 2-2 draw on aggregate, but it is the Blues who prolong their European adventure.
Despite entering the game with a two-goal deficit to make up, the hosts began the game in lacklustre fashion and allowed Mark Hughes' men to take the upper-hand.
Stephen Ireland was able to pull the strings in midfield but, with Ched Evans ploughing a lone furrow up front, the Blues struggled to create any clear-cut openings.
At the opposite end Shelton was getting little change out of Richard Dunne and Nedum Onuoha and he fed off scraps for most of the first half.
Early in the second period City finally got a clear sight of goal, but Evans blazed high over the bar as he failed to deal with a bobbling ball.
As things became more desperate for the Danes, City were able to take advantage of the space which began to open up.
Robinho lashed against the bar after being found by the hard-working Ireland, while Evans forced Karim Zaza into a smart stop after forcing his way into the box.
However, Aalborg finally forced a breakthrough with five minutes remaining as Shelton found room 10-yards out and crashed past the stranded Shay Given.
A remarkable climax was then completed when Evans handled in the box and Jakobsen smashed home from the spot.
Extra-time failed to produce any chances of note, so the game went to the lottery of penalties.
Shay Given saved from Thomas Augustinussen and Shelton, while City converted all four of their spot kicks to book a place in the last eight.
TacticAalborg, despite needing to chase the game, opted for a safety-first approach in the first half out of fear of conceding an away goal.
Only after the break did they begin to show any urgency but the tactic paid off dramatically as they turned the tie on its head in a frantic finale.
Until then City, despite playing cautiously themselves, made most of the early running in a contest that lacked bite.
Robinho, fit to feature after concerns over an ankle injury, looked to create an opening after collecting a crossfield ball from Shaun Wright-Phillips but his shot was blocked.
Evans also shaped to shoot after a Wayne Bridge cross ran through the box but his first touch was heavy and the opportunity passed.
Ireland, the game's most industrious player early on, got in the first clear shot at goal with 16 minutes gone but his effort flew over.
Aalborg offered little until Kasper Bogelund found space on the right but his tame cross was gathered by Given.
Anders Due then sent a more dangerous cross into the City box but Nedum Onuoha was alert and beat Shelton to the ball at the expense of a corner.
JinkedJamaica international Shelton was also thwarted by Onuoha as he tried to cross after finding room on the right.
Robinho jinked his way to the byline as City pushed late in the first half but goalkeeper Zaza stopped his ambitious shot with his foot.
Pablo Zabaleta curled in a shot after the ball broke to him from the resulting corner but it drifted wide.
Aalborg had the first of several penalty appeals early in the second half when Kasper Risgaard went down under Vincent Kompany's challenge as Jakobsen floated in a cross.
French referee Stephane Lannoy was unimpressed and City almost caught Aalborg on the break as Ireland set up Evans but the Welshman somehow managed to clear the stand from 10 yards.
City then survived a scare as Shelton nodded down to Caca but the Brazilian's low drilled shot just went wide of Given's left-hand post.
Aalborg had stronger and more vociferous penalty claims turned down on the hour when substitute Javier Garrido felled former Wigan player Andreas Johansson in a 50-50 challenge.
Lannoy was immediately surrounded by home players but City were reprieved.
Aalborg finally began to up the tempo and a low ball beat all in the City box but the visitors managed to clear.
WoodworkMichael Beauchamp tried to win another penalty but was booked for diving, Johansson had a shot deflected for a corner and Shelton forced Given to save one-handed.
City's attacks were becoming rarer but Robinho went close to settling the tie seven minutes from time when he hit the woodwork after Ireland reached the byline.
City then paid the price for failing to kill off Aalborg as the Danes remarkably broke through twice in the dying moments.
First Shelton blasted home from close range as the ball bounced up invitingly inside the area from a right-wing cross.
That set up a nervy finale and City were unable to hang on as Evans handled a Jakobsen header in the last minute.
This time the referee did point to the spot - at the fourth time of asking - and Jakobsen stepped up to smash into the top of the net from the spot.
The visitors looked tired but neither side could create a meaningful opportunity in the additional periods.
It came down to penalties and City comfortably tucked away all four of theirs while Given saved from Augustinussen and Shelton.
1st Half Goals
Shots on Target
Shots off Target