The home side took a one-goal lead into the interval following a smart finish from experienced midfielder Cani.
The Yellow Submarine doubled their lead in the early stages of the second period when Manu Trigueros headed into the back of the net.
Barcelona opened their tally after 65 minutes, however, when Gabriel Paulista could only turn a Dani Alves cross into his own net. Another own goal - this time from Mateo Musacchio - then levelled it up with little over 10 minutes remaining.
Barcelona completed the turnaround in the latter stages when Lionel Messi found the corner from close range.
Here, Sports Mole dissects the 90 minutes of action between the two La Liga rivals.
On target: 3
On target: 8
Was the result fair?
In truth, it is difficult to argue that Barcelona did not deserve to collect all the points this evening when reviewing the match and indeed statistics as a whole. However, the manner of the defeat will be extremely tough for Villarreal to take. At 2-0, the Yellow Submarine were extremely comfortable as Barcelona struggled to create clear openings, but the match and indeed atmosphere inside the stadium changed when the first own goal went in. The visitors were all but out of the title race with 30 minutes remaining, but showed brilliant character to turn it around. Both sides must be credited for contributing to the occasion.
There is no question that Villarreal's performances have dipped in the last few months following a brilliant start and middle section to the season. They were far from their best this evening, but found themselves 2-0 ahead after 55 minutes following two brilliant goals from Cani and Trigueros. From that point, there looked only to be one winner, but some poor defending and bad luck allowed Barcelona back into the match. The first own goal, which came from Gabriel, was unfortunate, but Musacchio's powerful header past his own goalkeeper was a poor piece of defending. Although the manner of the defeat would have hurt Villarreal, they only had themselves to blame. Poor passing and their inability to retain possession allowed Barcelona to dictate the latter stages and at 2-2, there was only likely to be one winner. That aside, it has been a brilliant campaign for Villarreal, who are very much in the mix for a Europa League finish in La Liga.
Like Villarreal, Barcelona have struggled to find consistency in recent weeks and that was indeed the case this evening. As expected, they dominated possession of the ball throughout the 90 minutes, but really struggled to create clear opportunities. Head coach Gerardo Martino selected Pedro and Alexis Sanchez either side of Messi, but neither really influenced proceedings, while Messi also struggled for long spells despite netting the winner late on. There were also more defensive problems for the Catalan outfit, with Villarreal always a threat on the counter. That said, the one major positive for Barcelona this evening was their character. It would have been easy to wilt and for certain players to fall into the background at 2-0 behind, but their key men stepped forward in the latter stages to complete what had seemed an unlikely turnaround for long spells. Overall, it was a lacklustre performance from the champions, but they remain in the La Liga race with just three games remaining.
Sports Mole's man of the match
Sergio Busquets: In what has been a disappointing season for Barcelona, Sergio Busquets is a player that can be proud of his performances in their famous shirt this season. Despite Messi's goals, Busquets has arguably been the Catalan outfit's player of the season and the Spaniard continued his impressive form this evening. The 26-year-old might not possess the same ball skills or pace as a number of his teammates, but there are few players in world football that read the game as well as the midfielder. It was not a faultless performance at El Madrigal, but he stepped forward in the latter stages when Barcelona needed a performance.
Villarreal might look back and regret missed chances this evening, but they would surely have won this match if it hadn't been for two own goals in the second period. As touched upon above, Gabriel's was more unlucky than anything. However, Musacchio will be extremely unhappy with the second. The 23-year-old has been one of the best centre-backs in La Liga this season, but he had a real horror moment after 83 minutes. A deep cross from Alves appeared harmless, but the Argentine somehow thumped a powerful header past his own goalkeeper. Quite what Musacchio had in mind is a question that only he can answer.
It was a busy evening for David Fernandez at El Madrigal. The experienced Spaniard issued six yellow cards - all of which came in the second period - as late challenges continued to arrive as the match gathered pace. There was a controversial moment late on when Fernandez appeared to point for a penalty following a challenge on Villarreal midfielder Javier Aquino from Busquets, but after consulting his linesman, a free kick was awarded. Overall, it was a composed performance from Fernandez.
Villarreal: It does not get any easier for the Yellow Submarine, who travel to the Estadio Ramon to tackle Sevilla next Sunday.
Barcelona: Barcelona simply must keep winning to remain in the La Liga title race and next up is Getafe at home next Saturday.