The Argentinian scored in both halves of the Group H fixture at the Camp Nou, to give Barcelona victory in the first-ever competitive meeting between the two sides.
It marked an emotional Champions League debut for coach Gerardo Martino, with victory coming just a few days after the death of his father.
After a bright opening, Messi broke the deadlock with fierce free kick in the 22nd minute.
His second came 10 minutes after halftime with a cool finish from inside the area, before Gerard Pique put gloss on the scoreline with a header from Neymar’s cross and Messi completed his treble when he feigned his shot before guiding an effort into the corner.
Kolbeinn Sigthorsson could have grabbed a consolation, but he saw his 77th-minute penalty saved by Victor Valdes.
Martino included Messi and Neymar in Barcelona’s starting XI, with the latter making his Champions League debut.
The Dutch side had Siem de Jong available, following his recovery from a collapsed lung.
Barcelona dominated possession in the opening exchanges and it took the lead when Messi once again lived up to his tag of the world’s best footballer with a stunning free kick in the 22nd minute.
After being felled by Lerin Duarte on the right, he picked himself up to hit a thunderous strike, with the ball going in off the the post as Kenneth Vermeer failed to keep it out at full stretch.
Ajax nearly stole an equalizer on the half-hour mark when Bojan curled a cross deep towards the far post and a diving header from Ricardo van Rhijn forced a smart reaction save from Valdes.
The visitors could have had a penalty when Sigthorsson went to ground under a challenge from Pique. The loose ball was met by Duarte, but he placed his first-time effort straight at Valdes.
After surviving those scares, Messi effectively ended the game as a contest in the 55th minute.
He controlled a Sergio Busquets pass on the right side of the box before feinting inside Stefano Denswil and firing his effort past Vermeer.
Barcelona continued to press and Neymar and Dani Alves both had efforts blocked.
And the pressure told in the 69th minute when Neymar played an in-swinging cross from the left that was met by the head of Pique to make it 3-0.
Messi then completed his hat trick with 15 minutes remaining. His dummied effort confused the whole defence, including Vermeer, before he slotted into the far corner.
Ajax could have had a consolation when Javier Mascherano fouled substitute Thulani Serero in the area but Sigthorsson saw his penalty beaten away by Valdes.