BARCELONA, Spain -- Barcelona was undone by Real Sociedad's potent attack 3-1 to relinquish the provisional Spanish league lead to Real Madrid after it eased to a 3-0 win over Elche on Saturday.
Barcelona coach Gerard Martino tried to reinforce his defence by playing with two holding midfielders in Sergio Busquets and Alex Song.
But Song scored an own goal in the 32nd minute in the first of several defensive lapses that doomed the defending champions.
Lionel Messi equalized in the 36th, but Antoine Griezmann restored the hosts' advantage after an error by defender Marc Bartra in the 54th before setting up David Zurutuza in the 59th with Barcelona turned into bystanders.
Barcelona and Atletico Madrid trail Madrid by three points. Atletico plays on Sunday.
Gareth Bale scored from a blistering long-range strike to help Madrid win its third straight game without Cristiano Ronaldo, who was finishing a three-game suspension.
Madrid midfielder Asier Illarramendi opened the scoring at the Santiago Bernabeu in the 34th. Bale then squashed Elche's timid second-half surge with a blast from about 25 metres in the 72nd before substitute Isco Alarcon sealed the victory in the 81st.
Bale was having a discreet outing until his superb strike to secure the three points that made Madrid the overnight pacesetters.
The Wales winger received the ball unmarked outside the area, sized up the goal, and unleashed a dipping strike that goalkeeper Manuel Herrera barely grazed before it hit the underside of the bar and bounced in.
"I said 'My goodness, what a goal' when I saw the ball pass by," Madrid fullback Dani Carvajal said.
Madrid will visit Schalke 04 on Wednesday in the Champions League final 16 enjoying an unbeaten streak of 26 games in all competitions. Madrid then plays at crosstown rival Atletico next weekend in a highly anticipated league meeting.
Also, Celta Vigo fought back for a 1-1 draw at home against 10-man Getafe to leave the visitors winless in the last 10 rounds.
Martino was dismissed by the referee during halftime, and the Barcelona manager had to witness the rare sight of his team being thoroughly dismantled in the second half from the Anoeta Stadium stands as the festive home fans soaked up their big win.
The victory moved Sociedad one point out of fourth place and Spain's last Champions League spot as the Basque side deployed its best version of its up-tempo attack.
Sociedad was unlucky not to widen the final margin when a disheartened Barcelona appeared to tire in the final minutes. Carlos Vela almost capped his outstanding performance in the 81st only for the ball to hit the post.
Barcelona went into the match in San Sebastian after affirming its European credentials with a dominant win at Manchester City this week.
But this stinging defeat confirmed the change in course in the league title race over the past two months, leaving Madrid in command and waiting to see if Atletico can keep up when it visits Osasuna on Sunday.
Martino's move to start Song ended up backfiring when Gorka Elustondo muscled by him to meet Sergio Canales' cross, which Elustondo appeared to graze with his head before it hit Song in the chest and landed in the net.
Messi combined with Martin Montoya to level when Sergio Busquets craftily let Montoya's pass run between his legs for Messi to rifle it inside the upright of Claudio Bravo's goal.
It was Messi's seventh goal in his last five games in all competitions and his 14th goal in league play despite missing over two months to injury.
Sociedad, however, went back ahead to re-ignite its supporters when Bartra headed Bravo's goalkick back toward his own area, where Vela was quick to pounce and crossed for Griezmann to volley the ball beyond Victor Valdes and record his 15th league goal.
Griezmann then spotted Zurutuza arriving in a second wave, and the midfielder beat Valdes to the cross and knocked the ball in.