Barcelona twice came from behind before eventually losing an entertaining Spanish Supercopa semifinal 3-2 to Real Madrid after extra time.
Luuk de Jong and then Ansu Fati cancelled out goals from Vinicius Jr. and Karim Benzema before Fede Valverde won the tie for Madrid on the counter in extra time.
Madrid will now face either Atletico Madrid or Athletic Club in Sunday's final, while Barça will return to Catalonia with their heads up despite the defeat.
Xavi's side were brilliant in spells in Riyadh and there was also good news in the returns of Pedri and Ansu from injury and a debut for Ferran Torres.
Pedri was especially good as a second-half substitute, while Ansu once again demonstrated his knack for scoring goals with his fifth of the season off the bench.
Madrid had earlier taken the lead when Sergio Busquets had his pocket picked by Benzema. The French striker teed up Vinicius to open the scoring.
That goal woke Barça up and De Jong had two headers saved by Thibaut Courtois before leveling at the near post from Ousmane Dembele's cross.
Barça improved after the break but Madrid remained a threat and took the lead through Benzema. Shortly after hitting the post, he found the back of the net from close range after his initial shot had been saved by Marc-Andre ter Stegen.
Xavi went on the attack, with Ansu, Memphis, Dembele and Abde all on the pitch, and Barça equalised for a second time through Ansu when he headed in Jordi Alba's cross.
Barça continued to press in extra time but were hit on the break when Madrid countered four on two, with Rodrygo crossing, Vinicius dummying and Valverde tucking home.