Chelsea 2 CFR Cluj 1
The Blues went into their final Group A game knowing that they needed a win to ensure a place in the knockout stages.
However, coach Luiz Felipe Scolari had to cope without the suspended Frank Lampard, with Joe Cole handed a start in his England colleague's absence.
The opening minutes saw little in the way of goalmouth action, but 13 minutes in Deco curled a free-kick from the left to the far post and Alex's downward header bounced off the turf and over the top of the crossbar.
Five minutes later the Blues had a let-off as Juan Culio made space to cross from the right and Hugo Alcantara's far-post header was hooked away from close to the line by John Obi Mikel.
The game then dropped into a slow rhythm, with neither side looking like finding a breakthrough in the next 20 minutes.
However, Chelsea took the lead five minutes before half-time as Deco's free-kick from deep was allowed to drop at the feet of Salomon Kalou and he lashed the ball home from eight yards out.
Nicolas Anleka was denied early on in the second half by Cluj goalkeeper Nuno Claro, but the visitors soon stunned Stamford Bridge as they drew level.
Culio nudged the ball to Cristian Panin and his accurate cross from the right was headed home emphatically at the far post by Yssouf Kone, who left Petr Cech grasping at thin air.
Joe Cole almost restored Chelsea's lead straightaway, but Nuno Claro was out quickly to make an excellent block.
However, the introduction of Didier Drogba was to prove crucial, as six minutes after coming on he latched on to a Joe Cole pass and took a touch before burying an expert low, right-foot shot from ten yards to make the score 2-1.
The Blues' cause was helped further by news coming through that Roma were winning 2-0 at home to Bordeaux.
The final whistle brought relief around Stamford Bridge, although the Blues had to settle for second place in the group.