Madrid - Barcelona notched their first away win in La Liga this season in Xavi Hernandez's first away game in charge as late goals from Memphis Depay and Philippe Coutinho secured a 3-1 victory over Villarreal on Saturday.
Barca had gone five away matches in the league without a win but Xavi had the magic touch, with the 41-year-old overseeing his second victory out of two in La Liga, either side of a midweek goalless draw at home to Benfica in the Champions League.
The score at La Ceramica flattered Barca, who could easily have lost a frantic game in which Villarreal spurned a number of excellent chances, only to commit a dreadful mistake at the back that allowed Depay to score in the 88th minute.
Coutinho added a third from the penalty spot in injury-time after Samuel Chukwueze had earlier cancelled out Frenkie de Jong's opener early in the second half.
"It was the game we dominated the least, but we won," said Xavi. "On Tuesday we deserved to win and we drew, today it could have been a draw, and we got the win. It's a tremendous victory for us."
Barcelona cut the gap to Atletico Madrid in fourth to three points, before Atletico play at Cadiz on Sunday. They are still seven points behind leaders Real Madrid, who are at home on Sunday to third-placed Sevilla.
One blot on the evening was an injury to Jordi Alba, who had to be replaced in the second half, with his fitness now a concern less than two weeks before Barca's pivotal final Champions League group game at Bayern Munich.
Woodwork struck twice
In a frantic opening nine minutes, Barcelona hit the post twice while Villarreal were gifted a golden opportunity as Abde Ezzalzouli's header was tipped onto the crossbar by Geronimo Rulli before Gavi's drive brushed the outside of the far post.
In between, Eric Garcia's backpass was intercepted by Arnaut Danjuma but his shot was blocked by the sliding Gerard Pique, who was lucky not to concede a penalty after making the stop with his right hand.
The chances kept coming for both teams as Depay scuffed wide after being slid through by De Jong before Yeremy Pino and Pau Torres both headed over when left free in the box, Torres from five yards out.
Villarreal were rampant down Barcelona's right-hand side and finished the first half the stronger.
But Barca survived and took the lead three minutes after the restart, Alba volleying Abde's cross back in for De Jong to tap home after Depay's initial finish was saved.
Alba went off injured, replaced by Oscar Mingueza, and Villarreal continued to stretch Barcelona, who never looked in control of their lead.
They could not even keep hold of a throw-in, Villarreal regaining possession and hooking the ball towards the penalty area, where Chukwueze nipped in ahead of Mingueza and poked into the corner.
Villarreal fancied a winner as Manu Trigueros twice went close and then Danjuma shot just wide of the post after a weaving run in from the left.
Instead, it was Barcelona who struck after capitalising on a Villarreal mix-up at the back.
Pervis Estupinan flicked Barca goalkeeper Marc-Andre ter Stegen's punt towards his own goal and Raul Albiol slipped as Depay darted through, rounded the goalkeeper and finished through the legs of Estupinan on the line.
Disheartened, Villarreal conceded a third in added time as Juan Foyth hacked down Coutinho, who planted the penalty into the bottom corner.