Two goals apiece for Henrik Larsson and Ramon Vega saw Celtic come through a shaky first half at Parkhead to book their place in the last eight of the Scottish Cup.
Scott Thomson gave Dunfermline some hope as the scores were level at the break but despite being well below their best Celtic kept their treble dreams alive.
Nobody gave Dunfermline a hope in this fourth-round replay following their three-goal defeat at home to Celtic on Sunday and the concession of 10 goals in their last two games.
But the home side were without striker Chris Sutton, who suffered shoulder damage at East End Park - so Tommy Johnson continued in the side alongside 40-goal man Henrik Larsson.
The home side started the brighter of the two teams as the visitors gave the ball away on far too many occasions. Larsson, who scored a wonder goal on Sunday, should have done better in the eighth minute when Lubo Moravcik curled in a dangerous cross after Alan Thompson's short corner and the Swede headed wide from six yards out.
The visitors did look threatening on the attack, but just two minutes later their goalkeeper Marco Ruitenbeek had to get down well to deny Moravcik who hit a right-foot shot on the turn from Joos Valgaeren's pass.
Moravcik again tried his luck in the 23rd minute with an adventurous rightfoot shot which flew just over the bar.
But the home crowd were beginning to get restless and Celtic gave them the perfect lift a minute later with the simplest of goals.
Thompson curled in a dangerous corner and Vega was unmarked to easily head into the empty net from all of five yards.
But if the visiting goalkeeper was at fault on that occasion, Celtic counterpart Robert Douglas was guilty of gifting Dunfermline the equaliser six minutes later.
The former Dundee man stayed rooted to the spot as Steven Hampshire bumped a hopeful ball downfield which eluded man-of-the-moment Neil Lennon and Scott Thomson flicked out his boot to lob the hesitant Douglas.
Celtic did regain the lead in the 49th minute, from a corner. Moravcik delivered a cross to the far post, and Vega headed home with the hint of a deflection from Thomson.
Celtic were desperate to kill the game off and they doubled their lead two minutes later.
Larsson went down under the challenge of Skerla and the Swede stepped up himself for the penalty to blast into the corner of the net for his 41st goal of the season.
O'Neill believed his side had done enough and a minute later he brought on Lambert and Petrov to tighten up the middle of the park and brought off Johnson and McNamara.
Celtic then killed the game off when they were awarded another penalty for Ferguson's foul on Larsson after Thompson's corner.
Larsson took the ball from Vega, who wanted his hat-trick, and again sent Ruitenbeek the wrong way, while Rossi went into referee Willy Young's book for dissent.
CELTIC: Douglas, Mjallby, Vega, Valgaeren, Agathe, McNamara, Lennon, Thompson, Moravcik, Larsson, Johnson. Subs: Gould, Boyd, Lambert, Petrov, Crainey.
DUNFERMLINE: Ruitenbeek, Doesburg, Skerla, Scott Thomson, Rossi, Dair, Nicholson, Ferguson, McGroarty, Hampshire, Crawford. Subs: Scott Y Thomson, Skinner, Bullen, Moss, Dijkhuizen.
Referee: W Young (Scotland).