Lowry fired a final round of 65 including an eagle and five birdies to finish 17 under.
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.”
Rahm had teed off almost three hours before leaders Viktor Hovland and Soren Kjeldsen – who would finish in a tie for fifth – and faced a long wait to see if his total would prove good enough.
“Nine under on the last 10 holes, it’s very good golf,” Rahm said. “It’s one of those things where everything clicked together and it was something I felt like was a long time coming.
“Since Mexico (his most recent win on May 1), I haven’t had a chance to win and posting a good score, whether or not I win is something I need, and I’m really happy with that.”
Although Gooch was the top LIV player thanks to an eagle on the 18th, for a long time it looked as though Patrick Reed’s 63 would strike another blow for what DP World Tour chief executive Keith Pelley had labelled the “LIV propaganda machine”.
McIlroy had said he found the LIV players’ presence “hard to stomach”, but Reed – who had set the early target on 14 under – insisted: “I definitely felt welcome. The guys were very respectful, very nice to me. They were the same as when I come over and play year-in and year-out every time.
“For me as a player and as an honorary lifetime member, I definitely will come back and play. I always want to play at least the minimum and continue to hold my card.
“I take pride in that, I take pride in being a worldwide player and coming over and playing on the European Tour (now DP World Tour). Nothing will change how I feel about coming over to play.”