Argentine Lionel Messi scored a vital 77th-minute winner as Barcelona laboured to a 2-1 home win over Athletic Bilbao on Sunday to restore their five-point lead over Real Madrid at the Spanish first division summit.
Barcelona looked set to drop two more points after Andoni Iraola's penalty had cancelled out David Villa's third-minute opener, however, Messi popped up with his 25th league goal of the season to clinch the points at Camp Nou.
"We couldn't afford another slip-up as Real Madrid were close," said Messi. "We won a very important match. There isn't that much left of the league to go now and every game is vital."
It was Pep Guardiola's 100th league match in charge of Barcelona and the manager was a relieved man as his side bounced back from their 2-1 Champions League defeat to Arsenal in midweek.
Real Madrid had closed to within two points of Barcelona with a 2-0 win over Levante and the Catalan club responded with a hard-fought victory.
With their 2-1 defeat at Arsenal still fresh in their minds, Barcelona were keen to get off to a good start and took the lead after just three minutes through Villa.
A diagonal pass from Xavi picked out the run of right back Dani Alves and the Brazilian laid the ball back for Villa to stroke home his 16th league goal of the season.
Bilbao could have equalised in the 10th minute with Fernando Llorente tricking Gerard Pique with a great drag back before crossing for Markel Susaeta, who headed just wide.
Villa was looking increasingly threatening and almost scored his second on 26 minutes but his brilliant chip came back off the crossbar.
The visitors had their chances though and stand-in goalkeeper Jose Pinto, deputising for the injured Victor Valdes, was forced to produce a fine diving save to stop a Llorente header in the 35th minute.
Barcelona then pressed the self-destruct button to allow the visitors to equalise four minutes after the interval.
French full back Eric Abidal sold team-mate Sergi Busquets short with a misplaced pass and the midfielder lunged in to take down Llorente and concede a penalty, which Iraola converted.
Messi came to life in the 58th minute, racing past three defenders before Fernando Amorabieta stopped him in his tracks in the box and Barcelona were furious as their penalty claims were turned down.
The breakthrough finally came in the 77th minute with Alves crossing for Messi to side-foot home with his weaker right foot.
Earlier, Villarreal missed the chance to close the gap on Champions League rivals Valencia, squandering more points in a 1-1 home draw against basement boys Malaga.
Valencia's 0-0 draw with Sporting Gijon on Saturday meant Villarreal could have gone third with victory, but Uruguayan Sebastian Fernandez scored an 82nd-minute equaliser to cancel out Marco Ruben's first-half opener.
Villarreal stay fourth, two points behind Valencia, after collecting just one point from the last nine.
"We have let two points get away and we are not happy," said Villarreal coach Juan Carlos Garrido. "We could and should have won this match.
"In the build-up to their goal, it looked like there was a penalty for a foul on Nilmar, but it wasn't awarded and the subsequent counter-attack ended with their goal."
It was a satisfactory return to El Madrigal for Malaga manager Manuel Pellegrini, who spent five successful years at Villarreal before leaving to become Real Madrid coach, although his side continue to prop up the table four points from safety.
In other matches, new Osasuna coach Jose Luis Mendilibar enjoyed a dream first match in charge as his side routed Espanyol 4-0 in Pamplona.
It was a fourth successive league loss for Espanyol, who stay sixth but have fallen nine points off the top four.
Sevilla took advantage of Espanyol's slip-up with a 1-0 home win over promoted Hercules to move to within three points of the top six.
Sevilla had failed to win any of their last six matches in all competitions, but Croatian Ivan Rakitic, signed from Schalke in the January transfer window, struck on 21 minutes to end that run and boost the club's European hopes.