Lionel Messi supplied two goals and an assist as Barcelona saw off Real Sociedad 3-2 at the Camp Nou to keep up the pressure on La Liga leaders Real Madrid ahead of El Clasico.
With Madrid having earlier beaten Sporting Gijon after a late goal from Isco, the tension was firmly back on Luis Enrique's side who had lost their last two matches.
Messi drilled in the opening goal from 25 yards after 17 minutes and then added a somewhat fortunate second when the ball bounced in off his leg from a rebound.
Sociedad reduced the deficit through an own goal by Barcelona defender Samuel Umtiti only for Paco Alcacer to quickly restore the hosts' advantage.
However, a neat finish by Xabi Prieto in first-half stoppage time set up a tense second period, as Enrique's men eventually got themselves back to winning ways as they prepare for two matches which could well define their campaign in Europe and at home.
Barcelona were looking to recover from the 3-0 Champions League defeat by Juventus which came on the back of last weekend's unexpected loss at Malaga, where Brazil forward Neymar was sent off and so handed a three-match domestic ban.
The hosts nearly found themselves trailing inside the first few minutes when Mikel Oyarzabal's goal-bound shot was cleared off the line by Gerard Pique.
Barcelona were soon on the offensive, with Luis Suarez stumbling in the penalty area as he tried to get on the end of a low cross from Jordi Alba.
Sociedad keeper Geronimo Rulli was quick off his line to make two important saves, first as Alcacer got into the right side of the penalty area and then when Sergi Roberto latched onto the rebound.
Messi, though, gave Rulli little chance when he drilled in the opening goal. The Argentina midfielder collected Suarez's square ball some 25 yards out and smashed it into the bottom right corner.
The visitors looked to regroup, but found themselves further behind on 37 minutes as Messi knocked in one of the most fortunate goals he is likely to score as he closes in on 500 for Barcelona.
Rulli saved Suarez's angled shot at the near post, with the rebound falling into Messi's path -- and the ball hooked off his trailing leg into an empty net.
Sociedad, aiming to close up on the European places, reduced the deficit in the 42nd minute. Barcelona keeper Marc-Andre ter Stegen saved a header from Willian Jose and Inigo Martinez was first to the loose ball, which he pulled across goal and it cannoned in off defender Samuel Umtiti.
The home side quickly restored their two-goal cushion when Alcacer was played into the left side of the Sociedad penalty area by Messi and drilled an angled shot past Rulli.
However, Barcelona paid for another lapse in concentration in first-half stoppage time. Jose clipped an angled pass across to Prieto who had ghosted into the right side of the penalty area and dispatched a cool sidefoot finish into the bottom corner.
After such a frantic finish to the opening period, there was a dip in tempo at the start of the second half. While Sociedad were happy enough to try to contain Barcelona, they also remained a threat on the counter.
As the hour mark approached, Jose found himself in space on the edge of the penalty area, but could not get his shot away.
Barcelona captain Andres Iniesta replaced Andre Gomes with 20 minutes left as Enrique aimed to inject fresh life into his team.
On 72 minutes, Ter Stegen was almost caught out by a long-range lob from Asier Illarramendi which the German tipped onto the crossbar.
In stoppage time, Rulli denied Suarez in a one-on-one as Barcelona put themselves back into a winning mindset ahead of next week's key matches.