Inter Milan crashed out of the Champions League on Tuesday after 17-year-old Ansu Fati became the youngest scorer in the competition's history by firing in a late winner to give Barcelona a 2-1 victory at San Siro.
Barca coach Ernesto Valverde rested Lionel Messi and several other key players for the trip to Milan, having already secured top spot in Group F, but Carles Perez put the Spaniards in front on his Champions League debut after just 23 minutes before Romelu Lukaku levelled on the stroke of halftime.
Inter striker Lautaro Martinez had the ball in the net twice after the break, only for both goals to be disallowed for offside, before Fati smashed in a sublime finish inside the final five minutes.
The Italian side needed to at least match Borussia Dortmund's result against Slavia Prague to maintain second place, but the Germans won 2-1 to move into the runner-up spot and consign Inter to a Europa League place.
Barcelona top the group with 14 points ahead of Dortmund on 10, while Inter finish third on seven ahead of rock-bottom Slavia Prague on two.
Valverde left Messi, Sergi Roberto and Gerard Pique at home and the likes of Marc-Andre Ter Stegen, Luis Suarez, Sergio Busquets and Frenkie de Jong on the bench as he fielded a youthful side in an experimental 3-5-2 formation that mirrored Inter's tactical set-up.
The hosts started with intent, as a last-gasp Clement Lenglet block denied Lukaku's close-range effort before Barcelona's debutant goalkeeper Neto was forced into a good save to deny Cristiano Biraghi's rasping shot.
However, it was the visitors who broke the deadlock against the run of play on the 23rd minute, when Antoine Griezmann's drilled pass was diverted into the path of Perez and the 21-year-old made no mistake from close range.
Inter's partnership of Martinez and Lukaku looked threatening throughout the first half and they combined for the equaliser on the brink of half-time, when Martinez showed great strength to hold off a defender and tee up the Belgian, whose low strike flew into the bottom corner.
Lukaku had a great chance to put the hosts in front on the hour mark when he outmuscled a defender to go one-on-one with the goalkeeper, but Neto was out quickly to charge down his shot.
Martinez thought he had found the breakthrough when he chested down a through ball and fired home, before being denied by the offside flag, and Inter again had a goal chalked off when Lukaku was in an offside position before Martinez prodded in from close range.
But it was Fati who stole the show just a minute after coming off the bench, exchanging passes with Suarez on the edge of the area before arrowing a low shot in off the post.
Aged 17 years and 40 days, the winger became the youngest player to score in the Champions League.