Rahm had set a testing clubhouse target of 16 under par following a stunning final round of 62, the former US Open champion carding two eagles and seven birdies and covering the back nine in just 29 despite a bogey on the 15th.
However, Lowry responded with an eagle and five birdies of his own in a closing 65 to finish 17 under, the former Open champion not carding a single bogey in a tournament reduced to 54 holes following the loss of Friday's play after the death of the Queen.
McIlroy found himself needing to eagle the 18th to force a play-off with Lowry but agonisingly saw his putt from 23 feet finish millimetres right of the hole.
The tournament had featured 18 players from the Saudi-backed LIV Golf series - American Talor Gooch was their top finisher in fourth - and Lowry had said at the start of the week that he "can't stand" them being in the field.
"I made no secret how I feel about the whole thing," Lowry said. "I wanted to win for myself first and foremost, but or everyone that has stayed loyal to this Tour I really feel this is one for the good guys."
Lowry, who had finished runner-up to McIlroy at Wentworth in 2014, added: "It means a lot.
"It's been a good year, but felt like I've been close a few times and only a few tournaments left this season and I really wanted to win one and this was top of the list.
"I'm so happy. I can't put into words how happy I am, how much I love this tour, this tournament. I'm the happiest man in the world right now.
"I got to 16 and was trying to get past that but had to worry about Rory behind me, he could do anything the last few holes how good he is. I just tried my best to hit shots, I told my coach I need to allow myself to play golf. I'm playing the best golf of my life and I did that.
"One of my main goals is to go to Rome next year and help win back the Ryder Cup so I'm delighted that qualifying started this week and I have made some good points."
A disappointed McIlroy, who carded a closing 67, said: "I'm okay. I think Shane winning softens the blow.
"If it had been someone else, I might not have felt as comfortable with it as I am. Seeing a friend win is always great and I am really happy for him.
"I struggled today. I didn't hit my irons very well. I was sort of scrambling a lot but I got the most out of my round.
"I wish I had made a four on 17, but, apart from that, I dug in there and did what I needed to do to give myself a chance going down 18 and that's all you can ask for."