McIlroy said: "I played a great back nine, which was nice, but just left myself too much to do.
"When I didn't eagle the 15th I knew it was going to be tough because he is very solid from tee to green.
"It wasn't to be. I didn't have my best game with me this week, but I'm happy with how I'm playing and hopefully it won't be long before I'm winning again.
"I've got two more tournaments before the Masters and that's what I'm building up to."
The US Open Champion had already halved two holes in bogeys when Mahan, conqueror of compatriot Mark Wilson in his semi-final, broke the deadlock with a tee shot to two feet on the sixth.
But McIlroy then double-bogeyed the 486 yard next, seeing a chip come back to him after both men had rolled down the slope in front of the green with their approaches, and then had another six on the long eighth after driving into a bunker and going long with his third.
Mahan went three up there despite three-putting for par and when both parred the next he had turned in a level par 36 to McIlroy's 39.
The gap became four when he missed from nine feet on the tenth after 29 year old Mahan had almost holed his approach and only did McIlroy spark into life.
He chipped in for eagle at the 11th and had a hat-trick of birdies from the 13th. That was the good news for his fans, but the bad was that Mahan matched two of the birdies and after lipping out for victory from 15 feet on the short 16th another par on the next settled it.
Mahan felt he had beaten "the best player in the world right now for sure" and added: "I felt great with my game coming in, switched putters and was able to run it out.
"We didn't have our best stuff early, but I was able to capitalise on a few miscues."
Earlier Westwood had won three of the first four against McIlroy, but opened the door by bogeying the fifth and then saw his former stablemate birdie six of the next eight, all but one of them for wins.
Westwood, now three down, then produced an 18 foot eagle putt after driving the green on the 343 yard 15th, but missed from similar range at the next and conceded defeat after bogeying the 17th.
The afternoon also went America's way in the third place play-off, Wilson never trailing either as he beat Westwood on the final green.