Atletico Madrid beat already eliminated Lokomotiv Moscow 2-0 to secure a spot in the round of 16 of the Champions League on Wednesday.
Teenage forward Joao Felix and defender Felipe scored a goal in each half to help Atletico clinch second place in Group D. Juventus advanced as the group winner.
Atletico would have advanced even with a loss as Bayer Leverkusen lost 2-0 to Juventus in Germany.
Atletico finished with 10 points, six fewer than Juventus and four more than Leverkusen. Lokomotiv had three points.
Felix put Atletico ahead by converting a 17th-minute penalty kick after video review due to a handball by Lokomotiv forward Rifat Zhemaletdinov inside the area.
Atletico had already missed a penalty taken by Kieran Trippier after Felix was fouled by Lokomotiv goalkeeper Anton Kochenkov less than a minute into the match at the Wanda Metropolitano Stadium. Trippier's shot from the spot was saved by Kochenkov.
Felipe added to the lead in the 54th with a neat volley from inside the area after a cross by Jorge ``Koke'' Resurreccion. It was the defender's first goal with Atletico since joining the Spanish club this season.
Striker Alvaro Morata also found the net for the hosts toward the end of the first half, but the goal was disallowed for offside on review.
The result halted Atletico's three-match winless streak and also ended its run of three straight games without scoring a goal.
Lokomotiv entered the match knowing it would finish last in Group D. Its only points in the group stage came from a 2-1 win at Leverkusen in the first match.
Atletico had won only one of its last eight matches in all competitions _ a 3-1 win at home against Espanyol in the Spanish league last month.
Wednesday's win kept Diego Simeone's side from losing three straight European matches for the first time since 1984. It was coming off a 1-0 loss at Juventus and a 2-1 defeat at Leverkusen.
Atletico was eliminated by Juventus in last season's round of 16.
(For more sports news and updates, follow Ahram Online Sports on Twitter at @AO_Sports and on Facebook at AhramOnlineSports.)