Despite only guaranteeing their top-flight place six days ago, Los Che remarkably hosted the champions, knowing that a win could be enough to secure UEFA Conference League football for next season.
With that in mind, a literally bouncing Mestalla crowd saw their side begin brightly after creating several clear-cut chances in the opening 20 minutes.
Diego Lopez blazed a close-range attempt over the bar before Gavi blocked Luis Rioja's effort. López then turned provider for Hugo Duro, but Valencia’s number nine agonisingly headed over the bar.
Carlos Corberan’s men were clearly sensing the opportunity to sneak into a European place, as Wojciech Szczesny was called into action to keep out Filip Ugrinic's low-driven effort.
Barca were comparatively much slower out of the traps, but could have broken the deadlock themselves when Alejandro Balde hit the side-netting after a neat one-two with Dani Olmo.
Robert Lewandowski then met Marcus Rashford’s corner at the near post, producing a header that cannoned off the post at the end of an absorbing first half.
That late chance led to a change in momentum at the start of the second half, and after the impressive Lopez was withdrawn injured, Barca broke the deadlock courtesy of a goal from Lewandowski on his final appearance for the club.
Pepelu’s headed clearance went straight into the path of Ferran Torres, whose cross-shot was turned up by the Polish frontman at the far post.
However, Corberan’s side restored parity just five minutes later when Javi Guerra weaved his way inside Barcelona’s defence and placed a left-footed shot past Szczesny to score a third goal in his last two appearances.
Rioja then turned the match completely on its head to spark pandemonium inside Mestalla, as the winger was allowed to cut inside on his left foot and drilled an accurate strike beyond Szczesny at the end of a blistering move.
It looked like a third Valencia goal was on the cards when Marc Bernal was penalised for a challenge on Jesus Vazquez. Referee Adrian Cordero Vega originally pointed to the spot, but VAR determined the offence had taken place outside the area.
As the clock ticked down, Andreas Christensen had an opportunity to restore parity with his outstretched right leg, only to be denied by Stole Dimitrievski.
The hosts would ultimately find a third deep into stoppage time when Guido Rodriguez drilled a low right-footed shot beneath Szczesny’s outstretched hand to seal all three points in style.
The result ensured Los Che went unbeaten in four successive top-flight games for the first time since last December and meant they finished in a very respectable ninth place.
Meanwhile, Hansi Flick’s side ended their campaign with a sixth league defeat of an otherwise brilliant campaign, which sees them finish eight points clear of Real Madrid at the top of the table.