Gerard Pique was sent off at halftime of his final match before retirement, seemingly for remonstrating with the referee, but Barcelona fought back to beat Osasuna 2-1 and move five points clear at the top of LaLiga on Tuesday.
The 35-year-old Pique, who waved goodbye to the Camp Nou last weekend, was incensed by referee Jesus Gil Manzano's decision to show Barca striker Robert Lewandowski a second yellow card just after the half-hour mark.
Pique, who was only named as a substitute by Barca coach Xavi Hernandez, angrily approached Manzano at the break.
"I was going to bring him on, yes," said Xavi.
"We knew that Andreas (Christensen) was coming back from injury, that he lacked a bit of rhythm. Eric Garcia was feeling pain... So Gerard was left and we thought we'd play him, yes.
"But they sent him off at halftime. It was the result of the tension of the moment. We felt injustice, hence Gerard's reaction."
Spanish media reported that Pique asked the referee: "But do you realise who you sent off?"
It was only the second dismissal of Lewandowski's career, with his second yellow given after an aerial challenge with David Garcia, who had earlier given Osasuna a sixth-minute lead.
Osasuna were hoping to climb into third place in LaLiga with victory, but were pegged back despite Barca's woes when Pedri levelled early in the second period.
Xavi was also booked before the hour mark as tempers threatened to boil over further.
But the Catalan giants had the final say when Brazil winger Raphinha headed home Frenkie de Jong's cross with five minutes to play.
Barcelona are now five points clear of rivals Real Madrid who suffered a shock 3-2 defeat at Rayo Vallecano on Monday.
"It was a game that we could have lost, but the team pulled together. I'm very proud of them," added Xavi.
Pique, a 2010 World Cup winner with Spain, won four Champions League titles with Barca.
The red card was his 11th for Barcelona, equalling Hristo Stoichkov's club record.
Earlier on Tuesday, Athletic Bilbao climbed to third with a 3-0 win over Real Valladolid.