A solid if not inspired performance was enough Saturday for Barcelona to prevail 2-1 over Real Sociedad and leave themselves needing just 6 points to clinch the LaLiga title.

With 77 points from 33 matches, Barça lead Atletico Madrid by 9 points and can secure the championship before the end of this month with victories against Alaves and Levante in their next two games.

For 10th-place Sociedad, it's now 28 years since they last won a match at Camp Nou, though they can take some comfort from forcing Barcelona to work for the points.

Barcelona coach Ernesto Valverde made only three changes from the lineup that crushed Manchester United 3-0 here a few days ago to send the Catalan club into the Champions League semifinal.

Even so, the hosts were below their usual standard and Sociedad set the tone for much of the first half.

Barça did plenty of attacking, but patience and coordination were lacking and the only anxious moments for visiting goalkeeper Gero Rulli came on a pair of free kicks by Leo Messi.

At the opposite end, Barcelona keeper Marc-Andre ter Stegen had to make stops in quick succession against Juanmi and Willian Jose before Rulli turned aside a low blast from Luis Suarez.

The hosts broke through in the 45th minute on a set piece, as Clement Lenglet got his head to an Ousmane Dembele corner to put Barcelona ahead 1-0 at the break.

Sociedad started the second half in high gear, making it difficult for Barcelona to play out from the back.

Ruben Pardo tried his luck from distance and the shot took a deflection off Barcelona defender Nelson Semedo, but Ter Stegen reacted in time to turn the ball aside.

And when midfielder Igor Zubeldia went down with an injury, Sociedad coach Imanol Alguacil decided to replace him with the attack-minded Luca Sangalli.

While the change initially helped Barça by opening up space in the middle of the pitch, Sociedad managed to string together enough passes for Mikel Merino to find Juanmi in scoring position and the forward deftly lifted the ball over Ter Stegen to make it 1-1 in the 62nd minute.

The Basque squad's joy turned out to be short-lived however, as it took only two minutes for the hosts to retake the lead.

Messi passed to Jordi Alba on the left side and instead of returning the ball to the Argentine star, the defender took the shot himself and beat Rulli for the 2-1.

Instead of sitting on the lead, Barcelona sought a third goal as Sociedad chased after another equalizer, but Alba had the final word.