Barcelona's winless streak at Real Sociedad stretched to eight games as the Spanish champions were outplayed in a 1-1 draw that leaves them six points adrift of La Liga leaders Real Madrid.

A sumptuous finish from Lionel Messi spared Barca's blushes after Willian Jose had headed Sociedad into a deserved lead just after half-time.

And Barca were 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 they now desperately need 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 haven't won in San Sebastian since 2007, but were grateful for the point as Sociedad failed to cash in on their 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 visitors' 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 were 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 respond -

====================

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, they 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 half-time and almost straight from kick-off 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, who 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 organised and had more of a collective effort which allowed us to kill off the game."

Granada remain winless and rooted to the bottom after a 3-1 defeat at Celta Vigo.