0637 GMT January 29, 2020
A sumptuous finish from Lionel Messi spared Barca's blushes after Willian Jose had headed Sociedad into a deserved lead just after halftime, AFP reported.
And Barca was fortunate to escape without a fifth consecutive league defeat in San Sebastian as Carlos Vela hit the woodwork twice and Juanmi's header was wrongly ruled out for offside.
"It is almost a miracle that we took a point," Barca boss Luis Enrique told BeIN Sports Spain.
"Real Sociedad were infinitely better than us with and without the ball. They won all the battles."
A point is enough to move Barca up to second, but it now desperately needs to beat Madrid in the first El Clasico of the season at the Camp Nou on Saturday.
Earlier, Atletico Madrid got back to winning ways and moved back into the top four as goals from Diego Godin, Kevin Gameiro and Yannick Carrasco ensured a comfortable 3-0 win at Osasuna.
Barcelona still has not won in San Sebastian since 2007, but was grateful for the point as Sociedad failed to cash in on its superiority.
"Playing like this it will be very difficult to win the league," added Barca defender Gerard Pique.
Xabi Prieto headed a guilt-edged chance wide, whilst Vela also fired off target when well-placed inside the area before the break.
The visitor's first effort on target came on 50 minutes when Geronimo Rulli turned behind Neymar's free-kick.
However, Sociedad went in front three minutes later when Pique, who played on in the second-half with a severely strapped ankle, could only slash Jose's effort into his own net after Marc-Andre ter Stegen had blocked Vela's initial effort.
Neymar started up front for Barca despite suffering a minor car accident in his Ferrari on Sunday morning.
And the Brazilian finally kickstarted a lame Barca display six minutes later as he burst down the left and crossed for Messi to apply a characteristically clinical finish for his 19th goal in 16 games this season.
Sociedad was cruelly denied 14 minutes from time when a wonderful hit by Vela came back off the underside of the bar and substitute Juanmi's finish from the rebound was wrongly ruled out for offside.
Asier Illarramendi then cleared off the line from Denis Suarez at the other end before Vela struck the woodwork again with a low effort that clipped the post in a frantic finale.
Atletico had suffered back-to-back La Liga defeats for the first time in four years at the hands of Sociedad and Real Madrid in recent weeks.
However, it never looked in danger after Jan Oblak had saved Roberto Torres's penalty with the scores still level at 0-0.
Godin nodded home Koke's corner nine minutes before halftime and almost straight from kickoff Angel Correa released Gameiro to double Atletico's lead.
Substitute Carrasco rounded off the scoring with his eighth goal of the season in stoppage time.
"It was a very important game for us for the way in which we ended up playing," said Atletico coach Diego Simeone.
Atletico leapfrog Villarreal, which earlier lost 2-0 at home to Alaves, into fourth and move back to within nine points of Real Madrid.
"Oblak was decisive with the penalty save and after Godin's goal we felt more comfortable," added Simeone.
"In the second half we were a lot more organized and had more of a collective effort which allowed us to kill off the game."
Granada remains winless and rooted to the bottom after a 3-1 defeat at Celta Vigo.