Chasing a record fifth consecutive triumph, Barca were undone by a relentless and gutsy Valencia side, who hung on after Lionel Messi pulled a goal back to set up a dramatic finish in Seville.
By then, Valencia were already two up, Kevin Gameiro and Rodrigo scoring twice in 13 frantic first-half minutes, after the latter spurned a golden early chance that could have spared them a nerve-shredding last 17 minutes.
Messi drove the comeback effort and Goncalo Guedes twice should have wrapped it up for Valencia, missing a one-on-one and then an open goal before the final whistle sparked pandemonium.
Valencia's coach Marcelino, who might have been sacked when his team were four points off relegation in January, raced around the pitch in a frenzy. Barcelona's players sank to their knees.
Messi admitted on Friday his team had still not recovered from the "hard blow" suffered against Liverpool and certainly they seemed too easily disheartened here, finding their fight only once it was too late.
Messi also threw his support behind Barcelona's coach Ernesto Valverde but it remains to be seen whether the backing of the board remains after two dreadful defeats have now spoiled such a brilliant La Liga campaign.
They came here as favourites, but only just, their 1,457 consecutive days as Copa del Rey champions under threat, from their own sense of deflation, key players out injured and Valencia's recent surge.
If Barca's season all but ended three weeks ago, Valencia's arguably found life a few days later, as they moved into the top four for the first time and then held on to qualify for the Champions League.
Winning their first trophy since 2008, in the club's centenary year, completes a remarkable comeback year that, after 15 games, had them languishing in 15th.
Some saw a metaphor in Barcelona's pre-match tifo, spelling out 'All Together' splitting down the middle, while there were key absentees from their starting line-up too, Marc-Andre ter Stegen, Luis Suarez and Ousmane Dembele all injured.
Valencia should have been ahead within five minutes, Clement Lenglet's error sending Rodrigo clear but his finish was brilliantly scooped off the line by the recovering Gerard Pique.
Barca, with Sergio Busquets in the centre of a back three, settled but lacked zip and in the 23rd minute they were behind. Jose Gaya scuttled in behind Nelson Semedo and his pull-back wrong-footed everyone except Gameiro, who fired in.
Semedo had been beaten down the left and soon after Jordi Alba was outrun down the right, by Carlos Soler, whose cross needed only to be nodded down and in by Rodrigo for number two.
Barcelona stirred before the break. Ivan Rakitic volleyed and then headed wide, before Messi registered their first shot on target in the 43rd minute.
Malcom and Arturo Vidal came on for Semedo and Arthur during the interval, as Barca turned the screw. Messi might have turned the match but after wriggling through his sumptuous flick towards the far corner brushed the post.
Pique fired wide as Valencia dropped deeper. Finally, Messi broke through, the post this time his friend after Lenglet's header struck the woodwork and landed kindly at his feet.
There were 17 minutes to survive and with six left, Messi headed over. The Valencia fans roared and then again when Messi was dispossessed by a sliding challenge.
Messi drove from the edge of the area but it was blocked and Guedes twice should have wrapped it up, first missing a one-on-one and then an open goal when Jasper Cillessen had gone up for a corner. He was perhaps as relieved as anyone when the whistle blew.