Lucho Gonzalez and Ricardo Quaresma got the goals for the Portuguese champions.

In France, Liverpool delivered an inspired performance when it really mattered to secure second place at the expense of Marseille.

The Reds became the first English side to beat Marseille at the Stade Velodrome in European competition as early goals by Steven Gerrard and Fernando Torres were added to by second-half strikes by Dirk Kuyt and Ryan Babel.

Schalke reached the knockout phase for the first time after beating Rosenborg 3-1 in their winner-takes-all clash to finish second in Group B.

Goals from Gerald Asamoah and Marcio Rafinha put the Germans 2-0 up inside 20 minutes before Yssouf Kone gave the Norwegians hope of getting the draw they needed to progress by halving the deficit.

But Kevin Kuranyi restored the home side's two-goal advantage before half-time and that was the end of the scoring, meaning Rosenborg were forced to settle for a UEFA Cup spot ahead of Valencia, who drew 0-0 at group winners Chelsea.

Real Madrid secured top spot in Group C with a 3-1 win against sorry Lazio, who failed even to secure a UEFA Cup spot.

The game was over before half-time thanks to goals from Julio Baptista, Raul and Robinho.

Goran Pandev netted a late consolation for the visitors, who saw a stoppage-time Tommaso Rocchi penalty saved by Iker Casillas.

Real were joined in the knockout phase by Olympiacos, who beat Werder Bremen 3-0 in Athens.

Ieroklis Stoltidis netted twice, either side of a Darko Kovacevic header to give Olympiacos their first taste of the knockout phase for nine years.

Bremen had the consolation of UEFA Cup football.