Barcelona won 3-1 at Alaves in LaLiga on Saturday thanks to goals by Robert Lewandowski, Ilkay Gundogan and substitute Victor Roque, who was sent off after picking up a second yellow card.
Barcelona opened the scoring thanks to an incisive pass from Gundogan to Lewandowski and the Pole lofted the ball over goalkeeper Antonio Sivera to score his ninth goal of the season.
Gundogan popped up early in the second half with a fine left-foot strike from Pedri's pass to increase Barcelona's lead.
Alaves launched a quick counter-attack two minutes later following a breakaway by Alex Sola who crossed for Samu Omorodion to head home.
"We knew how to compete and we were very solid at the back. The pity is that goal we conceded, because we had the game under control at 2-0 and within minutes they scored. We defended the box badly and that makes me angry, because we worked hard," said Barca coach Xavi Hernandez.
"But overall we played a very good and very mature game," added the coach in his second game after last week's surprise announcement of his departure at the end of the season.
"We have two victories after that decision, I said it was necessary and here is the reaction of the team. We have been very effective, something we had lacked all season. It's an important victory."
Barcelona increased their lead thanks to a shot from Roque, who had replaced Gundogan in the 63rd minute.
The Brazilian was sent off nine minutes later, however, after receiving yellow cards for an elbow on Nahuel Tenaglia and a foul on Rafa Marin.
"We are going to appeal the sending off of Vitor Roque. It is clear that it is a mistake, another one against us. Robert (Lewandowski) is our goalscorer and today he played a great game and Vitor too, he gives us goals and I think the sending-off was very unfair," Xavi added.
Barcelona are third in the standings on 50 points, seven behind leaders Real Madrid, who face Atletico Madrid on Sunday, and five adrift of second-placed Girona who play Real Sociedad.