The first set eventually went to a tiebreak and Williams held her nerve to secure the opener with a powerful ace. American golf champion Tiger Woods celebrated with a roar and a clenched fist.
Kontaveit showed her class early in the second set by breaking serve twice and taking a 3-0 lead, but Williams immediately got one on the breaks back to keep herself in the contest.
And the topsy-turvy second set had another twist, with the Estonian breaking serve for a third time to stamp her authority over the match.
Williams seemingly start conserving energy for the decisive set as Kontaveit cruised to a 6-2 victory in the second, getting the job done with an ace.
Things were getting tense at Flushing Meadows, but Williams rediscovered her mojo to secure an early break in the third set.
And Kontaveit wasn't budging, winning four consecutive points in the following game to break from 0-40 down and put the final set back on serve.
But Williams proved why she's a champion, breaking serve in the fourth game to go 3-1 ahead with her serve to come; the energy was electrifying.
The next four game remained on serve before Williams broke to love at 5-2 to claim an unforgettable victory 7-6 2-6 6-2.
After a glittering 27-year professional career, Williams entered this year's US Open preparing to bid farewell to tennis at the major tournament where it all began.
She now boasts a 23-2 record in her last 25 matches against players ranked in the top two, a run that dates back to 2007.
"I'm not in any rush here (to leave)," Williams proclaimed after the triumph.
"I'm loving this crowd, and there's still a little left in me. We'll see.
"This is what I do best, I haven't played many matches but I have been practising really well.
"The last couple of matches in New York it's really come together."
When asked whether she was surprised at her level, Williams replied: "I'm just Serena, you know?
"I'm just looking at it as a bonus, I have nothing to prove … I have nothing to lose.
"I haven't been able to play like this since 1998, I've had an X on my back since 1999."