In Group E Arsenal needed victory to secure their place in the last 16 and early goals from Jose Antonio Reyes, Thierry Henry and Francesc Fabregas ensured they enjoyed a comfortable night at Highbury.
Although Hoftun reduced the arrears, a Robert Pires penalty and a second-half effort by Robin van Persie completed the rout.
The win combined with PSV’s defeat at Panathinaikos, meant that Arsenal topped the group.
“As far as Europe is concerned the job is done,” said Arsenal manager Arsene Wenger, whose side ended top of Group E.
“It would have been very hard if we had gone out tonight.”
PSV Eindhoven, who had already qualified, finished second after being hammered 4-1 at Panathinaikos, the Greek side earning the consolation of a UEFA Cup place.
In Group F Shakhtar Donetsk claimed a UEFA Cup place with a 2-0 victory over Barcelona. Nigerian striker Julius Aghahowa scored both goals in the first half to earn the points.
Barcelona finished second in the group, behind Milan who drew 0-0 at Celtic, a result that ended the Scottish club’s participation in European competition this season.
In Group G Claudio Ranieri’s Valencia needed to beat Werder Bremen 1-0 or by a two-goal margin.
The Spanish champions dominated possession but were unable to breach the Werder defence.
With the game entering its closing stages, Paraguayan striker Nelson Valdez stunned the home side with tw goals, and to compound their misery, midfielder Miguel Angel Angulo was sent off for an ugly challenge on Valdez.
Ranieriwas unhappy at the performance of Swedish referee Anders Frisk.
“When you see the referee give them more than you, then you feel as though you were shafted,” he said.
“Now I understand what happened to him at Roma when they hit him on the head,” added Mourinho, referring to an incident this season during Roma’s Champions League match against Dynamo Kiev.
In the groups’s other game, leaders Inter enjoyed a comfortable 3-0 win over Anderlecht.
Group H saw the return of Jose Mourinho to his former club Porto. The Chelsea coach saw Damien Duff fire the Londoners ahead with a superb striker on 34 minutes.
Last season’s winners looked set for elimination, but a fine second half performance enabled them to produce the upset of the night.
Teenage Brazilian Diego levelled for Porto after 61 minutes with a wonderfully-strucck volley from the edge of the area, but with CSKA Moscow leading 3-1 at Paris St Germain, Porto knew only a victory would save them.
South African McCarthy was on hand to provide the winner four minutes from time, rising above William Gallas to send a header past Petr Cech.
“They were the second best team in the group and deserved to go through,” Mourinho said afterwards.
Chelsea finished with 13 points and Porto eight, while CSKA, for whom Sergei Semak scored a hat-trick in Paris, enter the UEFA Cup after coming third.