Cadiz beat Barcelona for the first time in La Liga since 1991 as former Manchester City striker Alvaro Negredo scored a famous winner.
It was a first home win in the top flight against any opposition for promoted Cadiz since 2006 and takes them four points above Barcelona.
Alvaro Gimenez put Cadiz in front before an own goal from Pedro Alcala brought Barca, who are seventh, level.
Negredo took advantage of shambolic defending to score the winner.
The 35-year-old, who had only been on the pitch for 44 seconds, closed down Marc-Andre ter Stegen before rounding the sliding Frenkie de Jong to tap into an empty net.
Setback for Koeman and Barca
Barcelona boss Ronald Koeman – who played in 1991 when Cadiz last beat Barca – appeared to have turned a corner after a poor start.
They had won six of their past seven games in all competitions but now sit 12 points behind leaders Atletico Madrid after 10 games. They are already six points off the Champions League places.
Barca have conceded several sloppy goals already this season and trailed when Ter Stegen stopped Oscar Mingueza from scoring an own goal but Gimenez finished from on the line.
They benefitted from an own goal by Alcala to level before Clement Lenglet failed to control Jordi Alba’s throw-in to give former Real Madrid striker Negredo the chance to score the winner.
Messi had 10 of Barca’s 21 shots, with five saved by Jeremias Ledesma, but in truth Cadiz deserved their victory with a counter-attacking masterclass that proved a success despite having only 18% possession.