Barcelona were denied the chance to wrap up domestic business before their Champions League final rivals Manchester United by a last-minute goal from Joseba Llorente. They were seconds from winning the league when Villarreal equalised, meaning Barcelona must now seal the title next week away to Real Mallorca.
Their penultimate home fixture of the season had begun with 98,000 people chanting "Iniesta, Iniesta, Iniesta" and ended with the Nou Camp reverberating to the sound of "Campeones, Campeones", but Barcelona were denied the chance to rubber-stamp their title win by almost the last kick.
The transition from last week's Champions League win to the sealing of the Spanish title had appeared seamless until 10 mad minutes. For 80 minutes Barcelona dominated the match as they have dominated the season. No team in Spain has ever won the treble. It is still on for Barcelona, but they must wait until Wednesday's Spanish Cup final for their first trophy.
Real Madrid had capitulated 24 hours earlier in a 3-0 defeat at Valencia that left the home side with one foot in next season's Champions League. For last season's champions the end of the season cannot come soon enough. Their coach, Juande Ramos, and half the squad look increasingly unlikely to be at the club next season.
The result meant a Barcelona home win would make them champions. Only two sides have left the Nou Camp with anything this season. Villarreal became the third.
The man who scored what will for ever be known in these parts as "the miracle goal", Andres Iniesta, made the first inroads into the Villarreal defence by going down in the box in the second minute. A more populist referee would have given the man of the moment a spot-kick, but the protests were waved away.
It mattered not. Samuel Eto'o volleyed Dani Alves' cross wide on six minutes and five minutes later midfielder Seydou Keita put the home side ahead. It was proof that Barcelona can score from anywhere. The former Seville midfielder would not have been on too many people's first-goal bet cards, but he ran on to Eric Abidal's pass and blasted a shot from the edge of the box past Diego Lopez.
Barça did not have it all their own way, with Villarreal playing the sort of football that deserted them against Arsenal in the Champions League.
They drew level when Ariel Ibagaza sent Giuseppe Rossi down the left and he crossed for Joseba Llorente to score from inside the six-yard box. Valdes then saved brilliantly from Rossi as Villarreal again carved Barcelona open.
Normal service was restored shortly after. Leo Messi took a quick free-kick to Xavi. His pass to the byline looked overhit, but somehow Iniesta hooked it back to a grateful Eto'o who swept it in – 28 league goals for Europe's top scorer.
Alves, as ever playing like a 1950s outside forward despite appearing on the teamsheet as a full-back, was an increasing threat down the right, setting up Eto'o, who almost scored the third. And on the stroke of half-time he buried a free-kick under Lopez's bar for the third.
Xavi tapped in after half-time but his goal was ruled out for offside and the flag was up again on the hour, this time justifiably, as Eto'o scored after Xavi and Alves had exchanged passes. As they searched for the fourth Villarreal hit them on the break and Abidal was sent off for the second time in a week.
He brought down the substitute Nihat and was sent off by the referee Fernando Vitienes. To deafening boos and whistles Mati Fernandez scored the penalty and that was the cue for a nervous last 10 minutes.
Alves was harshly judged to have clipped Bruno's heels, only for the referee to wave away calls for a penalty and give a free-kick. Villarreal wasted the chance and, with 10 men, Barça were seconds from holding on before Llorente did as Iniesta had done to Chelsea four days earlier and hit the back of the net in the final minute.
Barcelona (4-4-3): Valdes; Alves, Pique, Puyol, Abidal; Xavi (Busquets, 85), Keita, Touré; Messi (Gudjohnsen, 89), Eto'o (Sylvinho, 79), Iniesta.
Villarreal (4-4-2): Lopez; Venta, Rodrigues, Capdevila, Cani; Eguren, Ruben, Ibagaza (Fernandez, 73), Pires (Bruno, 64); Llorente, Rossi (Nihat, 64)
Referee: T Vitienes.