Barcelona’s dream of going a whole La Liga season unbeaten ended in their penultimate game as they were beaten by lowly Levante in a remarkable match.
The hosts moved into a 5-1 lead, with Emmanuel Boateng scoring a hat-trick and Enis Bardhi netting twice.
Barca’s Philippe Coutinho scored a hat-trick of his own and Luis Suarez netted a penalty to set up a tense finale.
But the champions could not find an equaliser as they fell to a first La Liga defeat in 44 games.
Ernesto Valverde, beaten in the league for the first time as Barcelona boss, may regret his decision to rest top scorer Lionel Messi for the trip to 15th-placed Levante.
After coming through their game against Real Madrid unbeaten last weekend, it looked as though history beckoned for Barcelona.
No side have gone an entire Spanish top flight season unbeaten since the 1930s, when there were only 18 games in a season.
But they fell just short in a match that almost defied logic – they had only conceded 24 goals in their opening 36 games.
With the league and cup double already wrapped up, and their Champions League run long over, it makes next Sunday’s final game against Real Sociedad largely irrelevant – except to send off departing captain Andres Iniesta.
How the mayhem unfolded
9 mins: 1-0 – Boateng opens the scoring, via the crossbar, after good play by Jose Luis Morales
13 mins: Almost a second goal as Bardhi hits the post from close range
30 mins: 2-0 – with Thomas Vermaelen off the pitch injured, Boateng goes round goalkeeper Marc-Andre ter Stegen and slams into an empty net after evading defender Nelson Semedo
38 mins: 2-1 – Luis Suarez finds Coutinho, whose 20-yard shot is deflected into the net
46 mins: 3-1 – less than a minute into the second half Bardhi curls a fabulous effort home from the edge of the box
49 mins: 4-1 – Boateng scores the first hat-trick of his career as he smashes home a first-time effort from former Aston Villa defender Antonio Luna’s pass
56 mins: 5-1 – Levante are in dreamland. Barcelona leave too much space at the back and Roger Marti plays the ball to Bardhi, who smashes home
59 mins: 5-2 – Coutinho slams home from close range after Suarez’s shot is blocked, but surely they cannot come back?
64 mins: 5-3 – Coutinho joins Boateng in the hat-trick club with another deflected shot from outside the box – but they still need two more
71 mins: 5-4 – Suarez scores a penalty after Sergio Busquets is fouled, and at this stage a comeback looks likely
90 mins: Levante should make it 6-4 as Busquets’ backpass does not find his keeper – but Ruben Rochina puts it wide from close range
94 mins: The full-time whistle goes to spark huge celebrations at the Estadi Ciutat de Valencia, and probably in Madrid too
Famous win for Levante
Barcelona should have expected a difficult evening at Levante, who have had a dramatic revival under boss Paco Lopez.
When he was promoted from his role as reserve-team boss in March, the club were only one point above the relegation zone.
But they have now won eight of their 10 games since his appointment – to take them 17 points clear of the bottom three.
Lopez said it would be “historic” for Levante, in their first season back in the top flight following promotion, to beat Barcelona and there were big celebrations at the final whistle on a famous night for the club nicknamed the Frogs.