The Dane had won just one set in seven harrowing defeats to Williams but she turned the tables with a 6-4, 6-4 victory in 89 minutes at the Singapore Indoor Stadium.
Wozniacki had some nervy moments after 37-year-old Williams, the tournament's oldest ever finalist, clawed her way back from 0-5 down in the second set.
But she kept her cool to seal victory with a backhand down the line, throwing her racquet into the air and holding her hands to her face in disbelief.
"I am so happy I managed to win in the end," said Wozniacki, describing the victory as "really sweet".
"Eight is my lucky number. If I was going to beat her (Williams) once in my career, it had to be today.
"I couldn't be happier right now. It's been an amazing year. Last year was tough with injuries but I fought my way back and to stand here and win the title means a lot to me."
Wozniacki has been in brilliant, aggressive form in Singapore, beating Elina Svitolina and Simona Halep at the group stage and Karolina Pliskova in the semi-finals.
After an even start, she seized control of the final by breaking four straight times across the sets to lead 5-0 in the second set.
With the title in her sights, Wozniacki was unable to serve it out in the seventh game and the ninth, when Williams produced an astounding crosscourt winner to win her fourth straight game.
But Wozniacki finally triumphed in the 10th game with her backhand down the line. She will now be third in the year-end rankings, after starting the tournament at sixth.
Williams looked increasingly weary as the match wore on after playing a gruelling, three-set semi-final against Caroline Garcia on Saturday.
"I didn't seem to come up with my best tennis until it was too late," the American said. "I love being here, it is an honour. Only eight players get to be here and I hope to return."
In a contrast of styles, counter-puncher Wozniacki tried to extend the rallies while her big-hitting opponent attempted to shorten points through sheer power and rushes to the net.
Wozniacki broke three times in the first set and took a one-set lead when Williams played a loose service game at 4-5 down -- just she second set she had ever conceded to the Dane.
Wozniacki, in her first WTA Finals since 2014, flourished in Singapore, with a tough three-set defeat to Caroline Garcia her only slip-up.
It completed a stellar comeback season for the two-time Grand Slam finalist, who endured an injury-marred 2016 and finished ranked number 19, her lowest position since 2007.
Williams was denied a 50th career triumph and first for the year, having finished runner-up at the Australian Open and Wimbledon.
She will remain the world number five after playing in her first WTA Finals since 2009.
Earlier, world number three pairing Timea Babos and Andrea Hlavackova won the WTA Finals doubles title on debut with a 4-6, 6-4, 10-5 comeback victory over Kiki Bertens and Johanna Larsson.
Swiss tennis great Martina Hingis announced her “definite” retirement on Thursday, signalling the end of a career which took her from 1990s teenage superstar to doubles world number one some 20 years later.
The 37-year-old “Swiss Miss” has retired twice before — once after testing positive for a metabolite of cocaine — but she said the ongoing WTA Finals in Singapore will be her last tournament.
“I think now it’s definite,” Hingis told reporters after her 6-3, 6-2 doubles win alongside Chan Yung-Jan over Anna-Lena Groenefeld and Kveta Peschke.
“So it’s different, because before I was, like, okay, I walked away, thinking I might come back, and if I didn’t, so that was it.
“Yeah, this time it’s definitely on the big stages of this world, the Grand Slams and the tennis world, I definitely won’t be doing that anymore. So it’s a different way, and I think it’s the right thing to do this time around.
“But I have also had great help from the WTA, from my sponsors. It’s a different time. I’m 37 now, so — and the world has changed. There is more social media and just show, as well.”
She added: “After a season like this, I think it’s also perfect timing. You know, you want to stop on top and not when you’re already going backwards. I couldn’t ask for a better finish.”
Hingis could end her career on a high in Singapore, with a semi-final looming against Timea Babos and Andrea Hlavackova.
“We have a pretty decent chance. I think we are the ones to beat right now,” she said.
Slovakian-born Hingis took the tennis world by storm when she won her first three major titles, the Australian Open, Wimbledon and US Open, in 1997 at the age of just 16, opening a period of dominance when she spent 209 weeks as world number one.
It was a run that inspired a young Roger Federer, the leading light of the group of Swiss players — also including Stan Wawrinka and Belinda Bencic — who followed Hingis onto the world stage.
Hingis, coached by her mother, Melanie Molitor, had five Grand Slam singles titles to her name when injuries drove her into her first retirement in 2003, when she was just 22.
She returned two years later but the comeback was short-lived and Hingis stepped away from the sport again after failing a drugs test at Wimbledon in 2007.
But she has enjoyed considerable success since her reincarnation as a doubles specialist, and ends her career at the top of the rankings and with 20 major titles in doubles and mixed doubles.
“Here we are for the third, and final time,” Hingis posted on Facebook. “Looking back now, it’s hard to believe that almost exactly 23 years ago I made my professional debut.
“The years that followed have been some of the most rewarding years of my life, both personally and professionally, but I believe the time has come for me to retire, which I will be doing after my last match here in Singapore.”
Hingis said she would remain involved in the sport, perhaps in a coaching capacity — which could raise questions over a potential match-up with Federer.
“I’ll always be part of the game of tennis,” she said. “Somehow we will be connected. I will definitely take some time out. I have done coaching before. I can help my mom, her tennis school. I’m definitely not going to miss that day-in, day-out grind.”
American veteran Venus Williams kept alive her dreams of winning the WTA Finals and making a shock return to world number one when she knocked out second-ranked Garbine Muguruza in straight sets on Thursday.
Williams, 37, defeated Muguruza 7-5, 6-4 in one hour and 41 minutes to become the second semi-finalist out of White Group behind world number three Karolina Pliskova, who finished top.
The seven-time Grand Slam winner moved around the court crisply, showing no ill effects from Tuesday’s three-hour marathon against Jelena Ostapenko, as she dumped out Wimbledon champion Muguruza.
“I was happy to win the last point,” Williams said. “It is not easy out here, you have to play every point well otherwise you lose the game.
“I had some great coaching coming into the game, I hope we can win some more.”
With the victory, Williams maintains her hopes of returning to world number one — a position she last held in 2002 — by winning the season finale on Sunday.
But it was a tame end for Muguruza, the WTA Player of the Year who demolished Williams in this year’s Wimbledon final, but who faded in Singapore after a strong start.
With both players needing to win to progress, they came out looking sharp but they also struggled to hold serve and Williams broke Muguruza five times to propel her to victory.
“I’m very proud of this year. It’s not going to change,” said Muguruza after getting eliminated from the tournament. “I knew here that it’s going to be tough, the best eight players are playing.
“My year has been incredible and best so far. I improved so many things. That’s what I’m going to take.”
The win means Williams, who lifted the trophy in 2008, has never failed to reach the semi-finals in five appearances at the season-ending tournament.
Earlier, the already-qualified Pliskova lost in straight sets to Jelena Ostapenko in her final White Group match, and admitted it was hard to lift herself for the dead rubber.
“It was really tough to push myself and play my best tennis when you know you’ve qualified,” the 25-year-old said, after she was outclassed 6-3, 6-1 in 66 minutes by the French Open champion.
“I haven’t ever been in this situation. I didn’t know how I was going to feel and how she was going to play. I think she played amazing.”
Despite the setback, Pliskova remained confident of bouncing back in her semi-final on Saturday. “I think it will now feel like a normal tournament,” she said.
“Hopefully I’ll be ready, and I’m sure I’m going to feel much better and play much better.”
Ostapenko’s victory, her first in Singapore, was a consolation after a disappointing WTA Finals debut, where she was eliminated after a three-set defeat to Venus Williams on Tuesday.
The Latvian said she was happy to finish the season on a high. “I think I was playing quite relaxed, and I just showed my best today,” Ostapenko said.
“It’s my first time (in the WTA Finals) and hopefully there are more times I will be here.”