CHARLOTTE, N.C. -- Rory McIlroy finally won when he least expected it, and it was as sweet as he could have imagined.

Only after he hung on for a one-shot victory in the Wells Fargo Championship, his first title in 18 months, did he reveal his neck locked up during his final practice session and if not for a late tee time Thursday, he would have had to withdraw.

And when he seized control Sunday afternoon with back-to-back birdies from the bunker down the stretch, he started to get ahead of himself thinking how cool it would be to see his wife and 8-month-old daughter waiting to celebrate with him on their first Mother's Day.

The finishing stretch at Quail Hollow snapped him back to reality. He hit a 7-iron safely over the water on the 17th, and caddie Harry Diamond wisely talked him into taking a penalty drop from a dangerous lie in a hazard on the closing hole. He two-putted from 45 feet for bogey, a 3-under 68 and a one-shot victory.

The moment with Erica and little Poppy was what he imagined. So was that trophy.

"It's tough to get over the line, especially if you haven't done it in a while," McIlroy said, a winner at Quail Hollow for the third time. "It's such a funny week, knowing my game was pretty good and then having my neck lock up on the range and sitting here Sunday night with the trophy.

"Just glad I got through it."

Abraham Ancer finished runner-up for the fourth time in his career as he seeks his first title. Ancer wasn't part of the picture until he ran off three straight birdies late that briefly gave him a share of the lead, and nearly closed with a fourth birdie when his 35-foot putt on No. 18 grazed the lip. He shot 66.

But this was about McIlroy and the second-longest winless drought of his career, who until this week had not played on the weekend in two months.

It was like he never was gone. McIlroy was bogey-free until the final hole, and even when he brought more pressure on himself with a poor tee shot, he delivered an 8-iron from just inside 200 yards to the fat of the green for his two-putt bogey to finish on 10-under 274.

His last victory was the HSBC Champions in Shanghai on Nov. 3, 2019. His next start is in two weeks at Kiawah Island for the PGA Championship, where he set the record in 2012 with an eight-shot victory.

How's that for timing?

"I'm excited going forward now," McIlroy said. His game is not perfect -- he hit only three of 14 fairways in the final round -- but he was quick to say a victory brought validation.

Locked in a tight race among Keith Mitchell, Gary Woodland and then Ancer, McIlroy delivered the goods on the back nine. He holed a 10-foot par putt on the par-3 13th. He got up-and-down for birdie with splendid bunker shots on the reachable par-4 14th and the par-5 15th.

He won for the 19th time on the PGA Tour, and 27th time worldwide.

"This is one of my favourite places in the world," said McIlroy, who picked up his first PGA Tour title at Quail Hollow in 2010. "To break the drought and win here, it's awesome."

It was a tough finish for Mitchell, who started the final round with a two-shot lead and quickly stretched it to three shots with a 6-iron out of a fairway bunker into a stiffening breeze to 12 feet for birdie.

But his short game let him down all day, leading to bogeys on the fifth and sixth holes that cost him the lead, and on the 14th hole and 15th holes when he had to settle for pars after being in position for birdies.

Mitchell needed to finish alone in second to qualify for the PGA Championship through the money list. But he dropped a shot on the 17th and closed with a 72 to tie for third with Viktor Hovland, who had a 67.

"Shows you how awesome he is as a player because he didn't have his best today and he still won and that's why he's got majors and a bunch of wins," Mitchell said.

Woodland had a share of the lead early on the back nine until he went through a bad patch of back-to-back bogeys on Nos. 12 and 13, and settling for pars on the next two scoring holes. He shot 71 and finished fifth.

McIlroy could have done without the drama on the 18th. With a two-shot lead, his drive went left of the winding stream into a deep hole of shaggy grass near the water. He started to try to gouge it out toward the fairway when Diamond stepped in to offer a few alternatives.

They picked the right one -- a penalty drop that limited any chaos, and McIlroy delivered a winner. His 2-foot par putt brought out one of the loudest cheers of a day filled with them. The Wells Fargo Championship had more energy than any tournament since golf returned from the pandemic.

Just what McIlroy needed.

He thought he would enjoy some quiet of no spectators. It didn't take long for him to realize he missed the energy. "To bring out the best in myself, I needed this," he said.

And when it was over, he turned and heaved his golf ball toward the crowd. That felt good, too.