Rivaldo completed a hat-trick with a stunning overhead kick a minute from the end of Barcelona's final league game against Valencia to earn the Catalans a 3-2 win and a place in the Champions League next season.
Rivaldo struck twice in the first half with two arrowed left-foot drives -- only for Ruben Baraja to head his side level each time.
Barca, needing to win to overtake Valencia in fourth place and bag the final Champions League slot, appeared set to be playing UEFA Cup football as the seconds ticked away.
But in a dramatic finale, Rivaldo took a chip forward from Frank de Boer on his chest and powered in an overhead of exquisite quality to salvage Barcelona's season.
Valencia, Champions League runners-up for the last two seasons, had to settle for a place in the UEFA Cup.