Rory McIlroy sank a pressure putt on the 18th to avoid a play-off with rival Patrick Reed and claim the Dubai Desert Classic.