A Munir goal less than two minutes into the game at La Rosaleda did little to set the tone for the contest as Malaga caused Luis Enrique's men all kinds of trouble, equalising before half-time through Juanpi.
But five-time Ballon d'Or winner Messi made the difference with a fabulous volley in the second half, sending Barca to the top of the table.
"It's a huge plus to have Messi in the team," Mascherano told the official Barcelona website.
READ MORE | No Nolito or new Neymar deal yet - the price of paying MSN
"Just like having players such as [Andres] Iniesta, [Luis] Suarez and Neymar.
"When we are having a tough time in general, they give you the chance to win the game.
"We won more due to individual quality than anything else, but the three points are great. It was vital to win."
Barcelona were second-best for the majority of the first half, but Mascherano sees no reason to panic after Saturday's difficult encounter.
"We look at the first half as a warning for the next game, but let's not go crazy," he added.
"We are performing well. The great teams also win when they play poorly."