Raul's record fell when Messi struck his first in the 38th minute to give Barcelona a 2-0 lead after Luis Suarez had opened the scoring. It was Messi's 91st match in Europe's top club competition.
Barcelona's Brazilian midfielder Rafihna unleashed a powerful shot from some 20 yards (meters) out. Despite being closely marked, Messi was able to get a foot to the ball and re-direct it past the helpless APOEL goalkeeper Urko Pardo.
Messi's teammates swarmed around him to congratulate the Argentina star on his achievement.
He struck again in the 58th when a defence-splitting pass from Dani Alves put him through and Messi's chip past Pardo bounced into the net off the post.
Messi rounded off the scoring in the 87th minute of the Group F match, completing his 28th Barcelona hat trick and his fifth in the Champions League.
Real Madrid's Cristiano Ronaldo, who has scored 70 goals in the Champions League from its group stages onwards, gets his chance to catch up with Messi's record when the defending champions face Basel away on Wednesday.
Messi's latest feat came three days after he became the Spanish league's all-time scorer by netting a hat trick to give him 253 goals in the domestic competition, two more than former Athletic Bilbao great Telmo Zarra scored from 1940-55.