The British top seed's title hopes appeared to be faltering when he trailed by a set and 3-0 down in the second set but the 2013 Wimbledon champion drew on his greater grasscourt pedigree to turn the match around.
Murray, who also hoisted the trophy in 2009, 2011, 2013 and 2015, had shared the previous record of four Queen's titles with seven other men, including Boris Becker, Roy Emerson and Raonic's new grasscourt coach John McEnroe.
However, a backhand volley into the net from Raonic allowed Murray to climb to the top of the pile and celebrate a winning start to his renewed coaching relationship with Ivan Lendl.
"This tournament has loads of history... it's a pleasure to play in front of someone like John [McEnroe]... and any time you can do something a bit better than someone like him, it's an amazing feeling," Murray said during the presentation ceremony.
"To win here for a fifth time means a lot to me."