Messi struck in either half, with his second being a landmark 50th career free-kick.
Clement Lenglet opened scoring for the hosts, before Kiko Olivas levelled in the 15th minute.
Messi then set up Arturo Vidal to give Barca the lead, before curling home an exquisite free-kick himself.
The Argentina captain added one more after the break, while Luis Suarez also got on the scoresheet.
The three points ensured Barca leapfrogged Granada back to the top of the table, with a seventh straight win in all competitions.