Coach Quique Setien had called for a professional performance after his side fell to a disappointing 2-1 defeat to Osasuna on Thursday night and also lost LaLiga to fierce rivals Real Madrid.
Setien had just 16 players in his squad for this match in the Basque Country, with a number of senior stars missing through injury or suspension.
Youngsters Riqui Puig and Ansu Fati were wanted by Barca B for a promotion play-off, but Setien selected the two La Maria graduates amid all the absences and was rewarded as both starred at Mendizorrotza.
Puig rifled a rising drive against the crossbar early on in the game as Barca hit the woodwork three times in the opening 16 minutes.
Messi also curled a shot onto the post from outside the box and Arturo Vidal crashed a fierce shot on the bounce onto the bar as Setien’s side dominated.
The breakthrough came after 24 minutes as Vidal found Sergi Roberto, who in turn picked out Messi on the right. The Argentine chipped in a cross, which deflected off an Alaves defender and Fati timed a run perfectly to fire home from just outside the six-yard box.
Messi made it 2-0 after he was put through superbly by Puig 10 minutes later, the Argentine hitting a low shot under Robert Jimenez for his 24th LaLiga goal of the season.
Two became three for Barca a minute before half-time as Messi curled a delightful ball into the path of Jordi Alba and the left-back volleyed across the area for Luis Suarez to head home unmarked.
Alaves made three changes at the break, but Barca continued to control the game in the second half and Puig set up substitute Nelson Semedo for the fourth as the Portuguese hit a low drive into the corner from the right side of the area.
Messi then added a fifth with 15 minutes left as he hit a first-time shot with his left foot inside the box following an Alba cross.
That strike was his 25th of the season in LaLiga and should be enough to wrap up the Pichichi prize for the competition’s top scorer, with Karim Benzema (on 21 goals) in action for Real Madrid at Leganes later on Sunday.
Barca finish the season on 82 points, in second place, with Alaves just clear of the drop zone in 16th.
Relive the action as it happened with Standard Sport!
Can't see the live blog? Click here to view the desktop version.