The win has taken the reigning champions to the summit - two points ahead of Los Blancos - but Zinedine Zidane's side now have three games in hand, starting with a trip to Osasuna on Saturday night.
© Getty Images
Gerard Pique, Javier Mascherano, Arda Turan and Rafinha were all absent for Barcelona, but Andres Iniesta returned to the squad after four weeks on the sidelines, and the experienced midfielder was named on the bench.
As for the hosts, Edgar Mendez, whose goal against Celta Vigo took Alaves into the final of the Copa del Rey, missed out with a hamstring problem, while the likes of Deyverson, Ibai Gomez and Victor Camarasa dropped out as head coach Mauricio Pellegrino shuffled his pack following their exertions in the cup.
Messi had the game's first half-chance in the fourth minute after finding space inside the Alaves box, but Spanish goalkeeper Fernando Pacheco was on hand to make a smart save.
Aleix Vidal was next to come close for Barcelona in the 15th minute, but the right-back could only fire over the crossbar after the ball had fallen for the Spaniard inside the home side's box.
The Spanish champions continued to dominate possession and had another opportunity in the 22nd minute when Luis Suarez found a yard of space inside the box, but Pacheco was on hand to make a smart save.
Both teams had brilliant chances to make the breakthrough in the 25th minute, but Marc-Andre ter Stegen kept out a low effort from Theo Hernandez after the full-back had embarked on a solo run, before Pacheco kept out Andre Gomes's strike down the other end.
Barcelona's dominance showed no signs of ending, however, and the visitors finally made the breakthrough in the 37th minute when Luis Suarez turned a low Vidal cross into the bottom corner from close range.
One became two in the 40th minute when Neymar placed the ball into an empty net after a mistake from Alaves goalkeeper Pacheco, who punched the ball against the head of Luis Suarez, had presented the Brazilian with the easiest of chances inside the box.
Alaves should have halved the deficit early in the second period when a cross from Ruben Sobrino found Christian Santos unmarked inside the Barcelona box, but the number nine somehow fired over the crossbar.
It took the visitors until just before the hour to create their first serious chance of the second half, and the opportunity was converted as Messi placed the ball through the goalkeeper's legs after breaking into the box.
Barcelona had their fourth in the 63rd minute when Alexis turned into his own net, and the away side's fifth and sixth goals quickly followed as Rakitic curled one into the top corner in the 65th minute, before Luis Suarez smashed home his second of the afternoon two minutes later after Pacheco had kept out an effort from Neymar.
The pace of the match dropped after Barcelona scored their sixth, although Luis Suarez had a couple of half-chances to complete his hat-trick in the final 20 minutes of what was a staggeringly one-sided affair.
Alaves finished the match having enjoyed just 30% of the possession, while Barcelona had more than 20 attempts on the home side's goal as Luis Enrique's side put the pressure on Real Madrid at the summit.
Next up for Barcelona is a trip to Paris Saint-Germain on Tuesday night for the first leg of their last-16 clash in the Champions League, before returning to La Liga action at home to Leganes next weekend. Alaves, meanwhile, will travel to Deportivo La Coruna in their next league fixture on February 18.