After reviewing yesterday's match, Barcelona's defeat wasn't really about luck; Real Sociedad truly prioritized their defense and capitalized on counterattacks quickly when Barcelona gave them the slightest opening. This has happened in the past, so Real Sociedad probably used the same tempo as before to beat Barcelona. Tactically, I admit Barca used good tactics, but Real Sociedad's experience was enough to prevent Barca from winning.
It wasn't entirely luck as Real Sociedad played solidly in defense preventing them from conceding. Barcelona eventually scored through Rashford in the 70th minute and Real Sociedad capitalized on their counter-attacking opportunities while Barcelona were busy attacking. Barcelona's dominance in the match didn't translate into a solid defense, making it difficult to deal with Real Sociedad's quick attacks resulting in Barcelona conceding two goals in a situation where they were looking for openings to break through against.