The Russian will now play the winner of the match between Poland's Agnieszka Radwanska and France's Marion Bartoli, who play their semi-final later on Thursday.
Sharapova was ahead early but lost the first set after her serve disappeared, allowing Wozniacki to win five consecutive games and take command of the match.
But the Russian, who has lost in all three of her previous final appearances in this tournament, recovered in the second set, striking the ball with impressive power.
"I could have easily, after losing a few straight games, let concentration down - I could have easily just gone down in the second set," said Sharapova.
"But I really stepped it up again. I went out there and started being aggressive. I didn't stop after I put myself in a good position. I'm extremely pleased that I pulled it out today."
Wozniacki stuck at her task however and with Sharapova serving for the match at 5-3 she broke, forcing two errors out of the Russian after winning a rally with a magnificent backhand cross-court winner.
The Dane held her serve and then faced Sharapova serving for the match again. There was a controversial finish to the match when Sharapova's serve at 40-15 was initially ruled out but the call was over-ruled by the chair umpire, who ordered the point to be replayed.
Wozniacki, whose return had found the net, protested the decision but with no challenges remaining she was stuck with the verdict and Sharapova subsequently wrapped up the win with a smart volley.
"Overall I'm pretty happy with my game," said Wozniacki, who beat Serena Williams in her quarter-final match. "This week I have been playing some really good tennis. And obviously you love to win and I didn't do that today."