Barca finished the season second in the standings on 82 points, four behind champions Real Madrid who visit Leganes later on Sunday. Alaves are 16th on 39.
Teenage forward Ansu Fati put Barca in front midway through the first half after the visitors had hit the woodwork three times, while Messi and strike partner Luis Suarez further stretched their lead before halftime.
Defender Nelson Semedo scored a fourth early in the second half before Messi struck again, scoring his 25th league goal of the season which is almost certain to land him the top scorer’s award for a record seventh time.
Messi has four more goals than Real Madrid’s Karim Benzema and is on course to win a record seventh Pichichi trophy — awarded for being top scorer in Spain — thus eclipsing the benchmark he shares with the late Telmo Zarra.
“Individual prizes and objectives are secondary. It’s an important achievement to win it seven times but I would have liked it to have been accompanied by the La Liga title,” Messi said.
The Argentine had made headlines on Thursday following his angry post-match interview after the 2-1 loss to Osasuna, blasting the team as weak and inconsistent, also appearing to criticise the running of the club.
But he was in a happier mood after the dominant performance against Alaves, saying the team felt more confident ahead of their Champions League last-16 second leg game with Napoli.
Today we saw something else, it was a difficult game due to the situation we were in and the kick off time and heat but the team responded with a different attitude and showed great commitment,” he added.
“We took a long hard look at ourselves from the inside which is what we needed to do. We have not had a good season in terms of performances or results but today we took a step forward.
“It’s an important step for what’s coming next.”