The double major winner came from seven shots back at the start of the final round to shoot a 6-under 66 and win by 1 stroke with an overall 14-under 274 on the Wentworth course.
It was McIlroy's first European Tour success since December 2012 and ends a run of eight second-place finishes in 11 events this season.
Shane Lowry of Ireland came second with a round of 68 for a 13-under 275. Denmark's Thomas Bjorn (75) shared third place on 12 under with England's two-time BMW PGA winner Luke Donald (70).
McIlroy's 12th victory worldwide comes four days after the 25-year old Northern Irishman confirmed the breakdown in his relationship with Danish tennis star Caroline Wozniacki.
McIlroy had been close to tears on Wednesday when talking to the media. He was still subdued Sunday despite his victory though he hugged his father Gerry and long-time coach Michael Bannon.
"I guess when I got inside the ropes this week, it was a little bit of a release, and I was on my own and doing what I do best, which is playing golf, and that sort of gave me four or five hours of serenity or sanctuary or whatever you want to call it," McIlroy said.
"I was just focusing on the job at hand which was to play golf and get the ball in the hole in the lowest number of shots possible ... It's obviously been a week of very mixed emotions, but I'm sitting here looking at this trophy going, 'How the hell, how did it happen this week?' But it did."
It was McIlroy's first success since coming from behind to win December's Australian Open in Sydney. He heads into next month's U.S. Open as a strong contender to win the event for a second time in four years.
"The win at the end of last year in Australia sort of stopped all the questions about equipment and about struggling and slump and all this stuff," McIlroy said.
"But to win here, against a great field, one of the best fields of the year, especially in Europe sort of cements that, and shows where my game is and I'm on the right track again. Hopefully, it won't be long before I'm contending in majors and having a chance to win those again."
Lowry went into the last day some five shots behind third round leader Bjorn but found himself in front when Bjorn took a triple bogey 7 at the par four No. 6.
After three birdies in a row from the 10th, Lowry had his own troubles in taking a double bogey at the par four 13th. However, the former Irish Open and Portugal Masters winner regrouped to birdie the 14th and, while he dropped a shot at the next, the 26-year-old Lowry holed a 30-foot birdie at the last to secure second place on his own.
"I'm happy but I know I am going to be sitting in my hotel room tonight and the 13th hole is going to be going through my head," Lowry said.
The 43-year-old Bjorn went into the last day with history on his side as no player had lost at this European Tour event after leading by five shots.
By the ninth hole Bjorn had forfeited his advantage - taking a bogey at No. 5, triple bogey at the sixth where he failed to get out of a greenside bunker in regulation, and dropping a further shot at the ninth.
The Dane birdied the 12th but was in trouble again with bogeys at Nos. 14 and 15 before birdies at the next two holes in an eventual round of 75.
"It's a disappointment when you come off the golf course like this," Bjorn said. "I just didn't get it right today and I made that massive judgment error on six and that kind of let everybody back into the frame."