ORLANDO, Fla. — Tyrrell Hatton went from losing his mind to winning the tournament.

Bay Hill served up the most demanding test this side of a major, and Hatton kept it together down the stretch Sunday by playing bogey-free over the last seven holes for a 2-over 74 to win the Arnold Palmer Invitational.

It was his fifth victory worldwide, and first on the PGA Tour, and it came in just his second start since returning from surgery on his right wrist during the off-season.

But the 28-year-old Englishman could only smile when he tapped in a 3-foot par putt on the 18th for a one-shot victory over Marc Leishman, one of the few players who kept moving forward — barely — on another day of blustery, brittle conditions at Bay Hill.

Hatton finished at 4-under 284, one of only four players who beat par for the week, the fewest at Bay Hill since 1980. So severe was the course that Matt Fitzpatrick closed with a 69, the only player to break 70 on the weekend.

Rory McIlroy, one shot behind going into the final round, had a 76 for his highest closing round in a PGA Tour-sanctioned event since a 76 in the 2013 U.S. Open at Merion. He still tied for fifth, his eighth consecutive finish in the top 5 world wide dating to September.

Sungjae Im, trying to become the first player since David Duval in 1997 to win his first two PGA Tour titles in consecutive weeks, was there with a chance until he came up shockingly short and into the water on the 13th for a double bogey.

He wasn't alone in making big numbers, a list that includes Hatton.

He had a three-shot lead when he drove into the water on the par-4 11th into the wind, went well over the green with his third shot, chipped short of the putting surface and had to make a 6-footer for a double bogey.

The gestures, the temper, it was all on display. And it didn't calm down when he eliminated a good birdie opportunity on the par-5 12th and then sent his tee shot on the 13th — a front pin on a green guarded by water — into the ankle-deep rough.

But he gouged that out to set up a two-putt par, and then Hatton held his nerve. He saved par from just off the green on his next two shots — they were good iron shots, but the putting surfaces were so hard they wouldn't hold anything. He saved par from the back bunker on the par-5 16th. And he hit the green — another minor miracle — on the par-3 17th for par.

“I actually thought I played myself out of it when I made double on 11,” Hatton said. “When I saw the scoreboard on 14 green, I realized I had a one-shot lead. I was a little bit surprised. To hold on and win here ... it such an iconic venue. I'm over the moon.”

Im closed with a 73 to finish alone in third, followed by Bryon DeChambeau, who shot 32 on the back nine for a 71. Nick Taylor of Abbotsford, B.C., shot a 7-over 79 to tie for 56th at 11 over.

Joel Dahmen didn't have a round better than 71 all week, and that was on Sunday. He never had a chance to win, but the tie for fifth earned him one of three spots into the British Open this summer. How to celebrate that?

“I think maybe just lay on the couch after this one,” Dahmen said.

Keith Mitchell (71) and Danny Lee (75) also earned exemptions to the Open at Royal St. George's.

McIlroy's chances began to fall apart when he hit driver through the fairway on the downwind, par-5 sixth hole into rough so thick his next shot squirted out to the right and into a bunker. From 90 yards away, he caught it too thin and it went over the green and into the rocks, leading to double bogey.

Three holes later, he closed out the back nine by sending his tee shot out-of-bounds to the left and onto the range. McIlroy shot 40 on the front nine, and when he three-putted from 25 feet for bogey on the par-5 12th, his chances were over.

The scoring average Sunday was 75.06, the toughest final round at Bay Hill since 1983. Hatton's 284 was the highest score to win the Arnold Palmer Invitational since it began in 1979.

But for a guy who looks as though he's seeing red, Hatton never looked better in the red Alpaca sweater that goes to the winner at Bay Hill.