Antoine Griezmann, Angel Correa and Rodrigo de Paul scored and three players were sent off as Atletico Madrid earned a place in the last 16 of the Champions League after a riotous 3-1 victory over Porto.
Following a goalless first half, Griezmann arrived at the far post after the break to divert in a corner and give Atletico the edge in a tight contest.
Yannick Carrasco lost his cool in the 67th minute, being sent off after grabbing Otavio's head, before Porto's Wendell was shown a straight red card just five minutes later for an elbow, making it a 10-a-side game. Unused Porto substitute Marchesin also saw red amid chaotic scenes.
Three goals were then scored from the 90th minute onwards, with Correa racing away to slot into the bottom corner and De Paul hammering in before Sergio Oliveira netted a consolation from the spot.
The first big chance of the game fell Atletico's way in the 22nd minute as Carrasco's low ball across the face of goal found Thomas Lemar, but Costa made the save at point-blank range and Griezmann could not connect with the loose ball with the goal gaping. The Porto goalkeeper then denied Marcos Llorente from a tight angle.
The visitors broke the deadlock in the 56th minute as Lemar's corner was flicked on by Geoffrey Kondogbia and turned in at the back post by Griezmann to give Diego Simeone's men a vital advantage.
Carrasco refused to give the ball back for a Porto throw-in before lashing out at Otavio as the Porto midfielder attempted to grab it from him, the Belgian earning himself a straight red card.
Ugly scenes ensued as both camps clashed, and Porto substitute Wendell suffered the same fate as Carrasco shortly after as he elbowed Angel Correa in the throat. Marchesin appeared to be red-carded for speaking out of turn from the sidelines.
Correa broke away in the 90th minute to double Atletico's advantage with a low finish into the bottom-left corner before De Paul smashed in the rebound after Griezmann's shot was saved two minutes later.
Porto pulled one back deep into stoppage time as Oliveira rifled a penalty past Jan Oblak, but Atletico had done enough to make it to the knockout stage. Porto must settle for the Europa League.