Pre-tournament favourites Ivory Coast, who had already qualified for the quarter-finals, began the contest slowly and conceded a penalty with six minutes on the clock.
However, Ryad Boudebouz failed to convert from 12 yards and the score remained level.
It wasn't until just after the hour mark when the deadlock was broken when on this occasion, Algeria did score from the spot. Arthur Boka was adjudged to have handled the ball inside the area and Valencia midfielder Sofiane Feghouli stepped up to dispatch the resultant penalty.
The Elephants responded positively though and seven minutes later the deficit was halved as Drogba headed in a cross from the left by Boka.
That prompted a large amount of pressure from the team wearing orange and it finally told eight minutes from time when Wilfried Bony's shot from distance took a deflection which deceived Rais M'Bolhi in the Algeria goal and flew into the roof of the net.
They will now face Nigeria on Sunday for a place in the semi-finals, while Algeria exit the competition.