There was plenty of late drama in Surrey as Lowry birdied the last to overtake early clubhouse leader Rahm at the summit.
But he then faced an anxious wait as McIlroy, in the group behind, gave himself an eagle putt at the 18th which would have pulled him alongside Lowry.
McIlroy's 23-foot effort just stayed above ground, though, handing Lowry his first victory in a tournament that means so much to him.
The Irishman has long had a terrific record at Wentworth Club, coming into the week with nine top-20 finishes to his name in this event.
And his love affair with the host venue continued as he carded an eagle and five birdies on Sunday to sign for a closing 65 and get to 17 under par, declaring himself "the happiest man in the world right now".
Lowry did not card a single bogey all week on his way to victory in the 2022 season's fourth Rolex Series event, which was shortened to 54 holes after Friday's play was cancelled following the death of Her Majesty Queen Elizabeth II on Thursday.
Rahm and McIlroy finished in a tie for second, one shot back on 16 under, with Talor Gooch another stroke further back.
After opening his final round with three straight pars, Lowry holed a ten-foot eagle putt at the fourth to jump to 12 under.
He then made back-to-back birdies at the seventh and eighth before another gain on the short tenth took him to 15 under - just one shot adrift of clubhouse leader Rahm.
Lowry almost took the outright lead at the long 12th but he was denied an eagle there as his bunker shot finished inches from the hole, having to settle for a par instead.
The 2019 Open Championship winner remained patient, parring the next five holes before giving himself an eagle try on the 18th.
His birdie there handed him a one-shot lead, and with McIlroy unable to join him on 17 under, Lowry added the BMW PGA Championship title to his CV.
He said: "I'm just so happy that I can win this tournament. I love this tournament and I love this course.
"I love coming here, the area, I just love everything about it. I'm so happy that I can come here and win the tournament this year.
"I feel like I've had a great year but it's not a great year unless you win. And I feel like this is just the glaze on the cake for me.
"I'm so happy. Honestly words can't (describe) how happy I am, how much this means to me and how much I love this Tour and how much I love this tournament. I'm the happiest man in the world right now.
"I said to my coach this morning, 'I need to just allow myself to play golf'. I'm playing the best golf of my life. I need to allow myself to do that and I did that."