Atletico Madrid snatched a place in the Champions League last 16 as they won 3-1 at Porto on Tuesday in a tense and ill-tempered game which saw both sides have a man sent off.
Antoine Griezmann put Atletico in front against the run of play in the 56th minute, bundling the ball into the net following a corner after the hosts had missed a glut of clear chances either side of the break.
Atletico's lead was threatened when Yannick Carrasco was sent off in the 67th minute for raising his hands to Otavio as tempers raged following a foul but Porto's numerical advantage lasted only a few moments as Wendell was dismissed for appearing to lightly strike Matheus Cunha with his elbow.
Substitute Angel Correa clinched the win for Atletico with a cold-blooded finish on the counter-attack in the 90th minute, while Rodrigo de Paul added a third goal 60 seconds later.
Porto then earned a consolation penalty which Sergio Oliveira converted with the final kick of the game.
Diego Simeone's Atleti side began the game bottom of Group B but ended it second on seven points, Porto coming third with five and qualifying for the Europa League.
Liverpool finished top with 18 points after winning 2-1 at AC Milan, who finished bottom with four.