Lamine Yamal and Raphinha shone as Barcelona secured a crucial 2-0 victory over Real Sociedad, propelling them into second place, just ahead of Catalan rivals Girona.
The defeat dealt a blow to Real Sociedad's hopes of qualifying for the Europa League next season, as they now sit in seventh place behind Real Betis, who claimed victory on Sunday.
Barcelona, last season's champions, are now playing for pride in the remaining weeks of a disappointing campaign. Finishing above the impressive underdogs Girona is essential for Barcelona to salvage some pride from this season.
Real Madrid secured the title with ease after Barcelona's recent 4-2 defeat to Girona.
Yamal opened the scoring for Barcelona just before halftime, and Raphinha sealed the victory with a late penalty.
"La Real are a great team; it's an important victory for us. We had a good game in general," Barca coach Xavi told Movistar.
Xavi benched Uruguayan center back Ronald Araujo, who has been out of form this season and whose red card against Paris Saint-Germain (PSG) contributed heavily to their Champions League collapse.
With Madrid reclaiming La Liga from the Catalans, Barcelona end the season trophyless and licking their wounds.
Xavi, who will stay in charge next season after ditching his exit plan, started defender Inigo Martinez in place of Araujo and Pedri Gonzalez in midfield.
The Canary Islander is still building form and fitness after a string of injury problems ahead of Euro 2024 and helped Barca control the game.
Striker Robert Lewandowski was unusually active in his team's pressing, perhaps motivated by the race to finish as La Liga's top scorer.
At the other end, Marc-Andre ter Stegen denied Sheraldo Becker after he burst beyond Pau Cubarsi, but the Suriname international had pushed the young defender in any case.
Shortly afterward, Becker got behind Barcelona's high line again and this time fired home but was correctly flagged offside.
Real Sociedad stopper Alex Remiro saved well from Yamal after the 16-year-old winger combined with Ilkay Gündoğan to break into the area.
Raphinha struck the post toward the end of the first half with a long-range effort, and Gündoğan turned the rebound over after it fell to him at an awkward angle.
It was a warning Real Sociedad did not heed, with Yamal sending Barca ahead soon after.
Lewandowski fed Gündoğan well with a low through-ball, and the German teed up the winger to steer home his fifth league goal of the season.
Barcelona started the second half strongly, with Raphinha twice coming close with fine long-range efforts.
Real Sociedad almost leveled when Brais Mendez won the ball back high up and fired inches wide of Ter Stegen's far post.
Remiro denied Barca substitute Ferran Torres, and Yamal's effort was deflected wide after a fine solo dribble, with the hosts struggling to kill off the game.
Eventually, they managed it when Alvaro Odriozola's handball led to a penalty – with VAR calling the referee to check the incident long after it occurred – and Raphinha dispatched it with aplomb.
"They took a few minutes to go to the VAR (but) if they gave it then it was a penalty," said Real Sociedad midfielder Benat Turrientes.
"We leave here hurt; we came to win, we've got a lot on the line to try to get into Europe, and I think we had chances, especially in the first half, to go in front.
"If you don't score, these teams end up scoring against you."
Xavi took off Lewandowski with 15 minutes remaining, and the Polish forward, who has 17 goals to his name this season in La Liga, trailing Girona's Artem Dovbyk by three, did not seem thrilled by the decision.
"We needed more fuel, more legs, we put in great effort, and Robert did very good work," said Xavi.
"I understand Lewandowski's annoyance; I didn't like being taken off either."
Barcelona faces Almeria on Thursday and Rayo Vallecano on Sunday as they try to stay in second place.