The Russian converted her fourth match point to take the third set tiebreak 7-5 and halt Davenport's bid for a record fifth title at the $1.3 million event.
Sharapova's eighth career title means she will rise from fourth to third in the world rankings.
It had looked as though Sharapova would run away with the match as she took the first set in just 22 minutes.
Her left leg heavily bandaged, Davenport could barely run and was moving gingerly between
The world number one went to the locker room for a medical time-out after the first set and the American fought back to take the second as Sharapova's concentration wavered.
The final set went with serve but Sharapova came up with the big shots to earn four match points.
The 17-year-old squandered three of them -- just as she did in her semi-final loss to Serena Williams at the Australian Open.
However, this time she held her nerve and ended Davenport's brave resistance with a forehand down the line after one hour 47 minutes.