Quique Setien had Lionel Messi to thank for ensuring he made a winning start as Barcelona’s new coach.

The club’s all-time leading scorer finally broke down a stubborn Granada after the visitors were reduced to 10 men to secure a 1-0 win at Camp Nou on Sunday.

Granada had kept Barcelona in check and hit the post in its best scoring chance moments before German Sanchez was sent off with 20 minutes to play after getting a second yellow card for fouling Messi.

A hole then appeared in the visitors’ defense which Messi exploited by passing to Antoine Griezmann inside the area. Griezmann quickly squared the ball for Arturo Vidal, who used his heel to roll it on for Messi to slot into the corner of the net for the 76th-minute winner.

Setien, who last coached at Real Betis, was hired by Barcelona on Monday after it fired Ernesto Valverde following a loss in the Spanish Super Cup semifinal to Atletico Madrid.

“I am happy. … We did many things well and I hope to go forward improving little by little,” Setien said.