Denmark's Wozniacki, who is the eighth and bottom seed at the end-of-season event, had to save a break point in the opening game of the match but then broke Sharapova immediately before moving 3-0 ahead.
The Russian, seeded second, fought back by winning three games in a row herself before Wozniacki appeared to make a crucial break to go 5-4 in front.
However, she could not serve out the set as Sharapova moved into a 0-40 lead before converting her third and final break-back point.
Soon the pair were in a tiebreak and it was Wozniacki who came out on top 7-4 by winning five points in a row after the change of ends.
The Dane then broke Sharapova in the first game of the second set to carry over her momentum from winning the breaker.
She had chances to move a double break in front in Sharapova's next service game, but could not take them and soon Sharapova had levelled the set at 3-3.
Both players then exchanged breaks again before a squandered set point from Sharapova saw it go to a second tiebreak.
Wozniacki battled back from 0-3 down to make it 3-3, but it was Sharapova who eventually came through 7-6 to level the tightly-contested match.
With over two and a half hours now on the clock, Wozniacki dominated early in the decider as a break put her 2-0 in front, only for another fightback from Sharapova to level things up at 2-2.
Wozniacki then broke again on her way to opening up a commanding 5-2 lead, and she was able to close out the encounter 7-6 6-7 6-2.