It was Mahan's fourth career victory - his second in a World Golf Championship event.
McIlroy, who would have moved to No. 1 in the world with a win, roared past Lee Westwood and in the semifinals. He won 3 and 1 with a par on the 17th.
In the other semifinal, Mahan never trailed and beat Mark Wilson, 2 and 1 in a battle of Americans.
Luke Donald will remain at No. 1 in the world.