Joao Cancelo and Joao Felix scored to overhaul Pepe’s opener.
Barcelona booked their passage to the Champions League last 16 for the first time in three seasons as Joao Felix’s second-half goal secured a 2-1 comeback win at home to Porto.
The former Atletico Madrid and Chelsea forward netted just before the hour mark after being set up by Joao Cancelo to seal the win and ensure it would not be a third consecutive group stage exit for Xavi’s side, despite having been given an early scare by the Portuguese side.
It was former Real Madrid stalwart Pepe who scored the goal for Porto that looked like it would set Barca up for a nervous final matchday in two weeks’ time, at 40 years old breaking his own record as the oldest ever goalscorer in the competition.
The lead lasted barely two minutes and it was ex-Manchester City player Cancelo who levelled in spectacular fashion.
Pedri swept a pass out wide to Cancelo advancing down the left but there was plenty still for the Portugal international to do as he carried the ball into the box and unleashed a superb right-footed effort that flew into the far corner.
Felix then got forward after the break to finish from Cancelo’s pass and secure a priceless win.
Shakhtar Donetsk’s earlier victory against Royal Antwerp had meant that Barca and Porto went into their match locked together on nine points with the Ukrainian champions, but Felix’s winner means Xavi’s side can relax in their final match against Antwerp whilst the other two teams play off for the right to join them in the last 16.
Barca earlier announced that teenage midfielder Gavi had undergone a “successful” operation on his torn anterior cruciate ligament, which is expected to rule him out for the rest of the season and the European Championship next summer.