The 25-year-old shared the third-round lead with the World Number Two and the pair went toe-to-toe in their bid for a Rolex Series victory at the Renaissance Club.
McIlroy led by one at the fifth but after a birdie at the eighth, he endured a barren run of ten straight pars to open the door for his American rival.
Gotterup took full advantage with birdies at the eighth, tenth and 12th to open up a two-shot lead, only to bogey the 15th.
However, he bounced back with a birdie at the next to re-establish his lead before parring his way home to secure his maiden DP World Tour title and earn a place at next week’s Open Championship at Royal Portrush.
“I just hung in there tight and tried to keep it together,” he said. ” Held it together really well and then it was so much fun out there.
“I don’t know if I’m going to be able to get it out but everyone at home, I don’t know, but I mean, this is awesome. I’m not going to be able to keep it together.
“It’s awesome. I can’t wait to see everyone and then I’m playing The Open next week.
“It’s all hitting me. It’s just so cool. I played really well this week, and I knew today was going to be tough. I hung in there like a champ and finished it off in style.
“I was a one-time champion. Two-time champ sounds a lot better. I know what I’m capable of and I know when I feel the way I did today, I can beat the best. It’s just awesome.”
Gotterup blinked first with a bogey at the opening hole, which gifted the sole lead to McIlroy at 11 under.
McIlroy missed the left edge with a long birdie putt at the next, which appeared to prove costly.
An erratic second shot saw him drop his first shot of the day at the third, seconds after playing partner Gotterup birdied from nine feet to return to 11 under.
The American was not alone for long as Marco Penge, McIlroy, Matt Fitzpatrick and Jake Knapp briefly shared a five-way tie at the top, until the Northern Irishman jumped ahead with a birdie at the fifth.
A brilliant par save kept McIlroy’s nose ahead at the seventh, but only for a couple of minutes as Gotterup climbed to 12 under with a birdie at the same hole.
McIlroy and Gotterup increased their lead to two with birdies at the eighth and they reached the turn with the same advantage.
However, Gotterup remained composed and when he rolled in his third birdie in four holes at the tenth, he was the outright leader at 14 under.
It was then advantage Gotterup when McIlroy somehow missed from four feet for birdie at the 12th and the lead stretched to two shots when the American rolled in his three-foot effort.
The momentum swung back in the Northern Irishman’s favour when the leader got horribly out of position with his approach at the 15th, accounting for a bogey to slip back to 14 under.
McIlroy was inches from rejoining the lead with his lengthy birdie effort at the same hole and he missed another chance at the next from eight feet.
Gotterup, though, kept his cool and drained his birdie putt from similar range to regain his two-shot advantage with two to play.
He nervelessly then parred his way home in a 66 to land his first Rolex Series success on only his sixth DP World Tour start.
McIlroy signed for a 68 in a share of second, with Englishman Penge continuing his stellar season with a closing 66 to finish at 13 under.
Nicolai Hojgaard earned his place at the 153rd Open Championship with a final-round 64 in a share of fourth at 12 under alongside Fitzpatrick.
Justin Rose carded the lowest round of the day – a flawless 63 – to finish one shot further back, while Ryder Cup team-mate Sepp Straka, of Austria, was in sole seventh at ten under.
World Number One Scottie Scheffler, World Number Three Xander Schauffele, Swede Ludvig Åberg and Norway’s Viktor Hovland wrapped up the top ten at nine under.
German Matti Schmid fired a closing 71 to finish at six under and claim the thid spot available at Royal Portrush next week.