Gerard Pique was back for Barcelona after missing last weekend's clash against Real Betis through injury, while there was also a start for Andres Iniesta. Luis Suarez, however, missed out once again due to a knee problem.
The first half-chance of the match came in the fifth minute when Gerard Deulofeu found space just outside the Alaves box, but the Spaniard saw his effort comfortably saved by Alaves goalkeeper Fernando Pacheco.
Pacheco was again called into action in the ninth minute to keep out a low strike from Messi, but Alaves were a threat down the other end, and only the offside flag prevented Sobrino from sending the home side ahead after the number seven had converted from close range.
Pacheco was by far the busier of the two goalkeepers in the opening 20 minutes, and the Spaniard did well to hold on to a curling effort from Iniesta, before keeping out Messi once again in the 23rd minute.
Alaves had a glorious chance to take the lead in the 31st minute when Sobrino broke into a one-on-one situation with Barcelona goalkeeper Marc-Andre ter Stegen, but the German made a brilliant save.
Pacheco was then called into action to keep out an effort from Deulofeu during an end-to-end period of the match, with both teams committing numbers forward on the counter-attack.
Barcelona were awarded a penalty in the 38th minute when Rodrigo Ely was adjudged to have pulled Pique to the ground inside the Alaves box, but Messi saw his spot kick kept out by Pacheco as the score remained goalless.
Pacheco also denied Deulofeu late in the first period, while Pique was booked for a deliberate handball inside the Alaves box as Barcelona were frustrated in the opening 45 minutes of football.
Alaves came close to scoring early in the second period when Ibai Gomez flashed a brilliant cross towards Manu Garcia, who had broken from midfield, but the number 19 just failed to make contact at the far post.
Messi curled one just wide of the Alaves post in the 48th minute as Barcelona started to find their feet after the break, before Pacheco kept out a free kick from Messi five minutes later.
Alaves finally conceded in the 55th minute, however, when Messi found the back of the net with a powerful effort, albeit with the help of a big deflection off Spanish centre-back Alexis.
Jordi Alba might have doubled Barcelona's lead in the 64th minute after finding himself free at the far post, but the left-back missed the crossbar as Alaves survived a dangerous moment.
Barcelona had their second in the 66th minute, however, when Messi smashed home from close range after a poor clearance from Alexis had bounced off Paco Alcacer and landed kindly for the Argentine.
Messi came close to completing his hat-trick in the 75th minute after curling one towards the top corner, but his effort hit the crossbar during a period of utter domination from Ernesto Valverde's side.
Paulinho came off the bench for his Barcelona debut in the 88th minute, but little occurred in the latter stages as the Catalan giants eased to a routine three points ahead of the international break.