Federico Valverde struck the winner in the 98th minute as Madrid recorded their 100th Clasico win after Luuk de Jong and Ansu Fati had earlier cancelled out goals from Vinicius Junior and Karim Benzema.
"I am sad and angry because the game was there for the taking for us," the Barca coach said in his post-game news conference.
"We played with a complex in the first 20 minutes, but we got over that. It was a day to be brave. This Barca side can compete against anyone. We didn't get the result we wanted, but it was still a step forward.
"The feelings are contradictory because we could almost touch the win. I'm sad because it's a Clasico defeat and we miss out on a trophy, but we dominated Madrid for large spells.
"We lack some experience, patience, responsibility. We made mistakes. We could have stopped [Madrid's] counters and been more responsible with the ball. But we're close."
Barca recorded 20 shots to Madrid's 14 at the King Fahd Stadium and registered 53% of the possession. Madrid had the better chances, though, with Benzema hitting the post in the second half and Rodrygo Goes missing a late opportunity to make it 4-2 in extra time.
Carlo Ancelotti disagreed with Xavi's assessment of the game, but he did give Barcelona credit for their performance in Riyadh.
"I don't agree [with Xavi], the game was even, they had more possession and we used the counter," the Madrid coach said.
"In the first half, we deserved to win, we conceded with some bad luck. The second half was more even but I don't think Madrid dominated Barca or that Barca dominated Madrid.
"We dropped off to enjoy the counter. The counter was effective. We had some quality moves -- the three goals were spectacular. An even game, honestly. It was a good show, we gave a good impression of Spanish football. In my opinion, Barcelona played well, too."
"We hope Alaba will be available for the weekend," Ancelotti said.
Barca midfielder Pedri came off the bench in the second half to make his first appearance since September after recovering from a thigh injury, while Ansu scored his fifth goal of the season as he returned from a hamstring problem that had sidelined him since November.
There was also a full debut for Torres, who signed from Manchester City this month, and Xavi believes all three players will be key to the club's hopes of finishing in the top four in LaLiga this season. They are currently sixth.
"Those three are going to help us a lot," Xavi said. "Pedri and Ferran need minutes and rhythm of matches after time out, but Ansu has come straight back with a goal. All of them are going to contribute massively this season."
While Madrid remain in Saudi Arabia to prepare for Sunday's final, Barca will have a free weekend. They're next in action against Athletic in the Copa del Rey next Wednesday.
ESPN FC correspondent Alex Kirkland contributed to this report.