Lionel Messi lost his cool after another Barcelona collapse on Sunday, hitting an opponent away from the ball and being sent off for the first time while playing with the Catalan club in the team's 3-2 loss to Athletic Bilbao in the final of the Spanish Super Cup.

Inaki Williams' goal in extra time gave Athletic the lead and a come-from-behind win. Barcelona had little chance of recovering when Messi swung his right arm toward the head of an Athletic player while trying to free himself. Messi was shown the red card following a video review.

The card came in his 753rd appearance with Barcelona. He has been sent off twice with Argentina, including in his national team debut in 2005. The other red card with Argentine came in the 2019 Copa America.

Messi could face a lengthy suspension for his ejection on Sunday.

After Athletic scored in the 90th minute to seal a 2-2 draw and force extra time, Williams netted the title-clinching goal with a neat curling shot from just inside the area, with the ball hitting the far post before going into the top corner.

"Because of what it meant for the team, this is the best goal of my career," Williams said.

The goal three minutes into extra time secured Athletic its third Super Cup title, and first since it beat Barcelona in the 2015 final. The Basque Country club also won the title in 1984.

Barcelona was seeking its 15th Super Cup title, and third in the last five seasons. It was also looking to end its title drought after going without a trophy last season, something that hadn't happened since 2007-08. The team got off to a slow start this season and trails Real Madrid and Atletico Madrid in the Spanish league.

Messi, who asked to leave Barcelona in the off-season but had his request denied, had been doubtful to play in the final because of an unspecified fitness issue that had caused coach Ronald Koeman to leave him out of the semifinal against Real Sociedad on Wednesday, when Barcelona prevailed in a penalty shootout.

He helped set up Antoine Griezmann's first goal on Sunday but was far from his best throughout the match at the La Cartuja Stadium in Seville.

Barcelona opened the scoring with a shot from the middle of the area by Griezmann in the 40th minute but Athletic equalized two minutes later with a close-range strike by Óscar de Marcos after a well-placed cross by Williams. Griezmann put Barcelona ahead with another shot from inside the area in the 77th but Athletic evened the match again with Asier Villalibre finding the net following a set piece in the 90th.

Villalibre was the player hit by Messi in the final minutes as the players tangled together outside the area. The ball was already on the left side of the area when the incident happened.

Athletic, which beat defending champion Real Madrid 2-1 in the other semifinal, had a 57th-minute goal disallowed by video review because of offside following a header by Raul Garcia, who had netted twice in the semifinal.

The final was the third match in charge for Athletic coach Marcelino Garcia Toral. His debut had been against Barcelona in a league game at home, when Messi scored twice to help the Catalan club recover from an early goal by Williams and secure a 3-2 victory.

"The players deserve all the credit for this achievement," the new coach said. "They defeated Real Madrid and Barcelona to be able to win this trophy."

Accompanying the Athletic squad in Seville was Aritz Aduriz, the club's former striker who was forced to retire last season because of a hip injury.

When Athletic defeated Barcelona in 2015, the Spanish Super Cup final was still played in two legs between the Spanish league and Copa del Rey winners.

This year's edition was moved to southern Spain after the coronavirus pandemic stopped it from being played in Saudi Arabia for a second straight season. The tournament's revamped Final Four format includes the top two finishers in the Spanish league and the finalists of the Copa del Rey from the previous season.