Match ends, Villarreal 2, Barcelona 3.
Lionel Messi's late winner kept Barcelona in the Spanish title race as they marked their first match since ex-coach Tito Vilanova's death with a superb comeback win at Villarreal.
The hosts held a 2-0 lead through Cani's precise finish and a powerful 15-yard header from Manu Trigueros.
But Villarreal defenders Gabriel Paulista and Mateo Musacchio both scored own goals to put Barca level.
Messi steered in the winner from close range as Barca moved into second.
The plucky fightback, where all three goals came in the space of 18 second-half minutes, means the Catalan club are four points adrift of leaders Atletico Madrid with three matches left.
The pair go head-to-head at the Nou Camp on the final day of the La Liga season, although Atletico - who beat Valencia earlier on Sunday - will become champions for the first time since 1996 if they beat Levante and Malaga in their next two matches.
The odds are still heavily stacked against Barcelona retaining the title which they won less than 12 months ago under the guidance of Vilanova.
Vilanova was forced to quit the club last summer as he battled cancer and the 45-year-old lost his fight against the disease on Friday.
Sunday's trip to Villarreal came under difficult circumstances for the grieving Barcelona players, but they managed to reignite their title ambitions with a gutsy victory.
Villarreal's El Madrigal stadium fell quiet ahead of kick-off, with many Barcelona players close to tears as Vilanova was remembered during a minute's silence.
However, they were focused from the first whistle as they made a high-tempo start against seventh-placed Villarreal.
|La Liga title run-in|
|Atletico Madrid||Real Madrid||Barcelona|
|3-4 May||Levante (A)||Valencia (H)||Getafe (H)|
|7 May||Valladolid (A)|
|10-11 May||Malaga (H)||Celta Vigo (A)||Elche (A)|
|18 May||Barcelona (A)||Espanyol (H)||Atl. Madrid (H)|
Barcelona, as they have done on many occasions in recent weeks, controlled possession in the first half without creating many clearcut chances.
And they were punished as Villarreal took the lead on the stroke of half-time.
Home midfielder Cani was allowed to run unmarked into the Barca area from deep, before steering Jonathan Pereira's perfectly-weighted pass first time into Barca keeper Jose Manuel Pinto's bottom-left corner.
Newly-promoted Villarreal have enjoyed a productive first season back in the Spanish top-flight, looking almost assured of finishing seventh and qualifying for next season's Europa League.
Both Atletico and Real Madrid could only manage draws at El Madrigal and even a point looked unlikely for Barcelona when Trigueros was left unmarked to plant in Javier Aquino's right-wing cross.
But Barca were handed a lifeline when Dani Alves's low cross-shot hit the heel of home defender Gabriel Paulista and flew into the net.
It was a huge slice of luck for the toiling visitors - and they were handed another shortly after. Alves, who had a banana thrown at him from the home crowd in a seemingly racially-motivated incident moments earlier, was again the architect as Musacchio headed the Brazil right-back's cross past his own keeper Sergio Asenjo.
Villarreal's players looked deflated, Barcelona sensed a victory was within grasp.
Messi's free-kick forced Asenjo, on a season-long loan from Barca's title rivals Atletico, into an acrobatic stop, but the home keeper was powerless to prevent the Argentine's 40th goal of the season.
The three-time Ballon d'Or winner latched on to substitute Cesc Fabregas's cushioned header, keeping his composure to bury the winner before poignantly pointing to the sky.
- 2Perez MartinezBooked at 56mins
- 14Trigueros MuñozBooked at 89mins
- 10Gracia CalmacheBooked at 90mins
- 7PerbetSubstituted forPereiraat 14'minutes
- 9G dos SantosSubstituted forUcheat 82'minutes
- 4PinaSubstituted forAquinoat 36'minutes
- 18Costa Jordá
- 19Torres Muñoz
- 25Sánchez Martínez
- 13Pinto Colorado
- 22Alves da Silva
- 16BusquetsBooked at 85mins
- 6HernándezSubstituted forTelloat 62'minutes
- 9SánchezBooked at 50minsSubstituted forFábregasat 62'minutes
- 7PedroSubstituted forRoberto Carnicerat 90'minutes
- 24Roberto Carnicer
- 25Olazábal Paredes
- David Fernández Borbalán
- Shots on Target
Second Half ends, Villarreal 2, Barcelona 3.
Lionel Messi (Barcelona) wins a free kick in the defensive half.
Foul by Gabriel Paulista (Villarreal).
Substitution, Barcelona. Sergi Roberto replaces Pedro.
Cani (Villarreal) is shown the yellow card.
Manu Trigueros (Villarreal) is shown the yellow card for a bad foul.
Dani Alves (Barcelona) wins a free kick on the right wing.
Foul by Manu Trigueros (Villarreal).
Offside, Villarreal. Mario tries a through ball, but Manu Trigueros is caught offside.
Sergio Busquets (Barcelona) is shown the yellow card.
Foul by Sergio Busquets (Barcelona).
Javier Aquino (Villarreal) wins a free kick in the attacking half.
Goal! Villarreal 2, Barcelona 3. Lionel Messi (Barcelona) right footed shot from the centre of the box to the bottom left corner. Assisted by Francesc Fábregas with a headed pass.
Substitution, Villarreal. Ikechukwu Uche replaces Giovani dos Santos.
Corner, Barcelona. Conceded by Sergio Asenjo.
Attempt saved. Lionel Messi (Barcelona) left footed shot from outside the box is saved in the top left corner.
Lionel Messi (Barcelona) wins a free kick in the attacking half.
Foul by Mateo Musacchio (Villarreal).
Own Goal by Mateo Musacchio, Villarreal. Villarreal 2, Barcelona 2.