SHANGHAI — Given another shot at winning the HSBC Champions, Rory McIlroy delivered his best of the day.

Even though he never trailed over the last 14 holes Sunday, and he didn't make a bogey all weekend, McIlroy felt fortunate to be standing on the tee at the par-5 18th in a playoff with defending champion Xander Schauffele.

On the final hole in regulation, McIlroy thought his drive was in the water, relieved to find it was a foot from the red hazard line.

After five hours of an exquisite battle among McIlroy, Schauffele and Louis Oosthuizen, the pivotal moment was when Schauffele reached into a hat on the 18th tee for a white slip of paper with "2'' written on it. That meant McIlroy would go first in the playoff.

And there was no doubt about his next two shots.

He followed a soaring drive down the middle of the fairway with a 4-iron from 223 yards into the wind to 25 feet that set up a two-putt birdie for the victory.

"If anything over the last few years ... for the most part, I've been able to get the best out of myself when I've needed it, and that's been a learning curve for me," McIlroy said. "But I've had enough experiences, and I've got a lot of great memories to draw back on. There's so many shots that I've hit under pressure that I can draw on."

He added another one at Sheshan International.

And he needed every one of them to hold off a bold performance by Schauffele, who spent four days trying to recover from the flu and nearly left Shanghai as the only player to win back-to-back in the HSBC Champions.

"I tried my best. Played great," Schauffele said. "I beat him on the day just to get in a playoff, and unfortunately I couldn't pull it off. I would have much rather played a par 3 for a playoff. He's the best driver in our game. Couldn't be happier for him. Like I said, I played great all week, fought. It was nice to have a chance."

McIlroy did everything right, closing with a 4-under 68 and going bogey-free over the last 39 holes he played.

Schauffele made him do a little more with birdies on two of the last four holes for a 66 to force a playoff at 19-under 269. That was as close as it got. Schauffele tugged his tee shot into thick rough near a bunker, laid up and narrowly missed a 12-foot birdie putt.

McIlroy won for the fourth time this year. It was his third World Golf Championships title, and his first since the Match Play at Harding Park in 2015.

"Xander pushed me the whole way, or all 73 holes we played together this week," McIlroy said. "We played every round. He played great. He was battling a flu all week, wasn't feeling his best, and so the calibre of golf he played this week, it takes some doing. He birdied the last to get into the playoff, and then I produced two of the best shots of the day when I needed it, which was really cool."

McIlroy moves a little closer to Brooks Koepka at No. 1 in the world with one tournament left, the DP World Tour Championship in Dubai the week before Thanksgiving to close out what already has been a special year. This is the fourth time McIlroy has won at least four times in a season.

He cannot catch Koepka this year even if McIlroy were to win in Dubai.

"I'm getting there," McIlroy said. "This win definitely helps and if I can get another win by the end of the year, I'll be feeling pretty good going into 2020."

Louis Oosthuizen birdied his opening two holes to set the early target, and he was tied with McIlroy until a tee shot into the trees on the ninth, and a chip that didn't reach the fairway, leading to bogey. Oosthuizen made another bogey on the 11th that effectively dropped him out of the race.

"You just can't give away holes," Oosthuizen said.

McIlroy took a two-shot lead with a bit of fortune on the par-5 14th. His second shot landed near the back pin but bounced hard into thick rough. His chip looked to be running some 10 feet by the hole, except that it hit the pin and left him a short birdie putt.

More fortune awaited on the 18th hole. One shot ahead of Schauffele, who was in the fairway, McIlroy went right and watched the ball bound off the hill and settle in thick rough a foot from the red hazard line. He punched out to the fairway, but his approach was 25 feet short and he missed a birdie putt for the win.

Phil Mickelson closed with a 68 and tied for 28th. With Shugo Imahira finishing second on the Japan Golf Tour, Mickelson will drop out of the top 50 in the world for the first time since Nov. 28, 1993, the longest consecutive streak in the top 50 since the Official World Golf Ranking began in 1986.

"It was a good run," Mickelson said. "But I'll be back."

Patrick Reed made one last audition as a captain's pick for the Presidents Cup with a 66 to tie for eighth. He has finished among the top 20 in 10 of his last 13 starts, including a victory in the FedEx Cup playoffs. U.S. captain Tiger Woods announces his selections on Thursday.

Sungjae Im, bidding for one of four picks for the International team by Ernie Els, had a 72 and tied for 11th.

McIlroy now gets a two-week break before wrapping up his year in Dubai.

"I want to finish the year on a high note," he said.

Corey Conners of Listowel, Ont., finished tied for 20th. Adam Hadwin of Abbotsford, B.C., tied for 46th.

___

More AP golf: https://apnews.com/apf-Golf and https://twitter.com/AP_Sports