Four-time major winner Rory McIlroy celebrated his first victory in 18 months on Sunday, then revealed a neck injury nearly prevented him from teeing it up at Quail Hollow.

"I didn't even think I was going to tee off in this tournament Wednesday night," said the Northern Ireland star, who came into the week ranked 15th in the world.

"If I had had a morning tee time on Thursday, I probably would have pulled out because I hurt my neck on Wednesday afternoon and couldn't make a backswing."

McIlroy, who won his first US PGA Tour title at Quail Hollow in 2010 and added another there at 2015, shot an unprepossessing one-over 72 on Thursday and was outside the projected cut line after the first round.

But he followed up with a five-under 66 to put himself in the hunt and shot back-to-back 68s on the weekend to win the Wells Fargo Championship by one stroke over Mexico's Abraham Ancer.

"This place has been good to me," McIlroy said. "Ever since I first set eyes on this golf course, I loved it from the first time I played it, and that love has sort of been reciprocated back."

Adding to the emotion was the buzz provided by crowds as close to pre-pandemic levels as the US tour has seen.

McIlroy acknowledged during the tournament that he had missed the energy provided by fans more than he realized he would.

"I'm certainly glad that the crowds were back and I'm glad that I was able to get the job done in an atmosphere like that today," he said.

"And I'm excited going forward now that we get to play in front of crowds like that. It was just an awesome experience to feel that again over the weekend."

But it still wasn't easy to get over the line for the first time since winning the WGC HSBC Champions at Shanghai in November of 2019.

He arrived at 18 with a two-shot lead, took a penalty after driving into rough near a water hazard and closed with a bogey for the win.

He said the emotion was a combination of relief and satisfaction.

"It's such a funny week, knowing that my game was pretty good coming in here and then have my neck completely lock up on me on the range on Wednesday afternoon, not even thinking I was going to play on Thursday, and then I'm sitting here on Sunday night with a trophy.

"Just glad that I got through it and played some really good golf over the weekend."