(CNN) -- Rory McIlroy kept alive his hopes of winning the European Tour's Race to Dubai with a thrilling victory in the Hong Kong Open on Sunday.
The Northern Irishman carded a five-under-par 65 at Fanling, including holing his bunker shot on the last hole, to win by two shots from France's Gregory Havret.
It was McIlroy's first official tournament win since claiming the U.S. Open at Congressional in June and leaves him a little under 800,000 euros behind England's Luke Donald heading to the climax of the season -- the Dubai World Championship -- which starts on Thursday on the Earth Course in the emirate.
The 22-year-old, who also won last month's Shanghai Masters although that was an invitational event that did not count towards the final rankings and money list, can overhaul Donald as European No.1 if he wins the climax to the European Tour season and Donald finishes lower than ninth.
Donald, who is bidding to become the first man to top the money lists on both sides of the Atlantic, is also under pressure for his World No.1 spot from McIlroy.
"It meant a lot knowing that I had to go out there and play well to keep myself alive in The Race to Dubai, probably to keep second place in the world rankings. To produce the sort of golf I did today was very pleasing," McIlroy told the official European Tour website.
"That was one of the goals going out today, to win this tournament to keep myself in with a shout next week.
"That is very dependent on what Luke does because he has got such a big lead -- if I can somehow get myself into contention next week, you never know. "
McIlroy started the final round three shots behind overnight leader Alvaro Quiros, who faded to a three-over-par 73.
Birdies on the second and ninth took him to the turn at nine-under-par overall and into a share of the lead.
Another birdie at the 12th saw him hit the front followed by a birdie two at the par three 15th.
But playing partner Havret was also making up ground fast and McIlroy had a slender one-shot lead as the played the 18th.
Havret found sand off his tee shot and was forced to lay up short of the green with his second shot, but McIlroy also ended in a greenside bunker with his approach.
After Havret had pitched to 20-feet from the flag, McIlroy conjured up his final piece of magic by holing his bunker shot to round out victory on 12-under 268.
"When the ball went in, I think that's the most excited I've ever been on a golf course. It was just incredible to see the ball drop and realise that I had finally won this tournament," said McIlroy.
Swede Peter Hanson finished third on nine-under while defending champion Ian Poulter charged through the field on the final day to card a 66 and finish in a tie for fourth at eight-under alongside Scot Richie Ramsay and Thailand's Pariya Junhasavasdikul.