Barcelona won their first LaLiga match of the post-Lionel Messi era with a 4-2 victory that saw Real Sociedad mount a late rally.

Their season-opening match at Camp Nou came after a drama-filled week that saw club legend Messi, who had been with Barca for 21 years, join Paris Saint-Germain on a free transfer.

Gerard Pique scored Barca's first goal on the night with a close-range header from Memphis Depay's free kick delivery in the 19th minute.

Martin Braithwaite doubled Barca's lead just seconds before half-time with a back-post header off a delivery from Frenkie de Jong.

Braithwaite made it two on the night for him when he scored in the 59th minute after goalkeeper Alex Remiro palmed the ball into the path of the Danish striker.

La Real pulled one back in the 82nd minute when Julen Lobete scored, with Mikel Oyarzabal scoring three minutes later on a stunning free-kick to cut Barca's lead to one. However, Sergio Roberto scored in the waning moments to secure the three points.

The match the return of fans to Camp Nou in 17 months, with 20,000 supporters in attendance. Some fans hung a series of banners at the stadium attacking Barcelona president Joan Laporta for his role in Messi's departure.