La Liga: Villarreal 0 Barcelona 1
Barca toiled on a poor El Madrigal pitch and against a stubborn home defence until 19-year-old Sandro came off the bench to score a scrappy 82nd-minute winner on his first La Liga appearance.
Lionel Messi, captaining Barca in the absence of Andres Iniesta, wriggled free down the right and his low cross-shot was diverted into Sandro's path by Villarreal keeper Sergio Asenjo, and the youngster stabbed home from three yards.
Asenjo had been in superb form up to that point and was perhaps unfortunate to be on the losing side, while Villarreal also hit the post twice shortly before Sandro broke the deadlock.
The win means new Barca coach Luis Enrique has six points from his two games in charge, following on from last week's 3-0 defeat of Elche, and the 44-year-old will also be buoyed by the return of Neymar, who came on as a substitute for the final half an hour.
Villarreal were without Nigeria striker Ikechukwu Uche due to injury, with Bruno coming in as they effectively played without a centre-forward, while Barca had Javier Mascherano suspended following his red card against Elche.
The hosts had to weather an early storm and Asenjo produced an acrobatic dive to get to a well-struck Pedro shot after he was fed by Messi.
However, Villarreal should have taken the lead on 22 minutes, only for defender Victor Ruiz to fail to connect properly after a wicked cross from the right found its way through to him at the back post.
Barca predictably responded and Asenjo showed great reflexes to tip a deflected Messi free-kick onto the post.
Dani Alves - who received a hostile reception from the home fans after last season's racism storm - was enjoying plenty of space out wide while overlapping from the right, but Barca were frustrated in their attempts to force an opener.
Denis Cheryshev showed good pace on the break for Villarreal at the start of the second half and Barcelona survived another scare when back-tracking defender Jeremy Mathieu turned a cross onto his own post.
Normal service was soon resumed as Barca began to dominate possession again, but they were too often reduced to floating in hopeful balls from the flanks with teenage forward Munir failing to make his presence felt before making way for Neymar.
The Brazil star almost scored soon after his introduction, but just failed to force the ball home in a goalmouth scramble before then wildly firing another half-chance over.
Tomas Pina then struck the woodwork for Villarreal, before Messi burst through on the right side of the area and his stab across goal was poked home by Sandro to claim a hard-earned three points for the visitors.