Messi whipped home a lovely free-kick six minutes from the end to down resilient Alaves, who are just two points from the drop zone in 17th despite John Guidetti silencing the Camp Nou with a shock breakaway opener in the 23rd minute.
Barcelona sit 11 points clear of second-placed Atletico Madrid in La Liga but now turn their attentions to their Copa del Rey class with Valencia on Thursday night (8.30pm).
Alaves were the only team to win at the Nou Camp in the league last season and looked set to overshadow Philippe Coutinho's first start for Barca when Sweden striker John Guidetti gave them a shock lead in the 23rd minute, falling over as he lashed the ball past Marc-Andre ter Stegen.
Luis Suarez and Lionel Messi both scored in the second half to ensure they didn't drop points at the top of the table. Alaves were also denied a late penalty when the ball struck Barca defender Samuel Umtiti's right hand inside the box.
Lionel Messi scored a late free-kick as Barcelona staged a second-half comeback to defeat Alaves 2-1 in Philippe Coutinho's full debut at the Nou Camp.
"Players are not machines who can fit in at once, like a new part", said Valverde.
Barca controlled the ball from the first minute but found Alaves' 4-4-2 formation a stubborn obstacle, and were made to wait until the 15th minute for a first sight of goal; Messi just failing to reach Suarez's low driven cross.
With just six minutes left, Barcelona were awarded a free-kick and Messi stepped up to produce a spectacular effort that beat Pacheco to give the three points to Barcelona.
"I feel good, I've started the year well and I hope to continue the goals and assists". "He has important skills, the other day he played 20 minutes, today he played a little more, he's growing into the team little by little".