Yet, the game will leave a bitter taste in Barca fans' mouth as superstar Ousmane Dembele was subbed off injured.
He was later shown on camera limping. The club is yet to give a statement but he might be out for a while.
The French winger has been one of Barca's scorers in recent games including his goals against Atletico Madrid and Real Sociedad (in the Copa del Rey quarterfinals).
Barca were less sharp in the first half especially playing without Robert Lewandowski with Ansu Fati replacing the Polish.
In the 61st minute, substitute Jordi Alba with a low cross into the box was punched by Gazzaniga into the feet of Pedri who was there to tuck it home.
The Spanish midfield is only 20 and he is making his 100th app for the club.
PEDRI IS MAKING HIS 100TH APPEARANCE!— FC Barcelona (@FCBarcelona) January 28, 2023
Barca will now face Real Betis on Wednesday without Dembele but they will have Lewandowski back from his 3-match suspension.
The victory moves the Catalans 6 points clear of Real Madrid who is set to play Real Sociedad on Sunday