Lionel Messi came off the bench to spark a Barcelona comeback as the Catalans fight back from 1-0 down against Real Betis to win 3-2 at the Benito Villamarin.
Messi and Pedri were both left out of the starting lineup as Ronald Koeman rotated his squad for the trip to Andalusia, but the decision backfired as Barcelona struggled to get going in the first half.
The Catalans suffered a blow when Ronald Araujo was forced off through injury after just eight minutes and Borja Iglesias gave Real Betis the lead seven minutes from half time, sliding in to get on the end of an Emerson cross into the middle.
Pedri was thrown on for the start of the second half, but it took the introduction of Messi for Barcelona to find a final product, with the 33-year-old scoring at the near post having been on the pitch for just three minutes.
And Messi created the opportunity from which Barcelona scored their second, threading through Jordi Alba who squared for Antoine Griezmann. The Frenchman fluffled his lines, but the ball bounced over the line off the legs of Victor Ruiz.
Ruiz made amends for his own goal just minutes later, though, by scoring an equaliser at the right end of the pitch, rising highest to get on the end of a Nabil Fekir freekick and head past Marc-Andre ter Stegen.
Barcelona, however, still managed to find a winner three minutes from the end when substitute Francisco Trincao won a ball inside the opposition box and lashed home a left-footed finish off the underside of the bar.
The result sees Barcelona, who have now won six games in a row in all competitions, move up to second place in the La Liga table, once again leapfrogging rivals Real Madrid and Sevilla despite their respective victories on Saturday.