The 33-year-old beat fellow Italian Roberta Vinci 7-6 (7/4), 6-2 to become the oldest first time winner at a major.
She the admitted she had made the decision before the tournament to call it quits.
“Before I started this tournament one month ago, I took a big decision about my life,” said the 26th seed.
“I decided that this is the way I would say goodbye to tennis. This is my last US Open and I couldn't think of finishing in a better way,” said the 26th seed.
Playing in her 11th US Open, Pennetta said she was stunned to have gone so far in the competition.
“I'm really happy. I never thought I would get so far and never thought I would be a champion. This is one of my favorite tournaments, I enjoy playing here,” she said of an event where she has consistently recorded her best results at the majors.
“It's a dream come true, and it's also nice to play with a friend of mine — we have known each other since we were nine years old, we spend so much time together.
“We could write a book about our lives,” added Pennetta after collecting the winner's check for $3.3 million.
Vinci, the world number 43 and a year younger than her Fed Cup teammate, had stunned world number one Serena Williams in the semi-finals.
But she was unable to repeat that form on Saturday.
“It was tough, I passed the 24 hours with a lot of things on my mind,” she said.
“But I am really happy and happy for Flavia. It's tough to play against a player who you have known for a long time.
“I tried to play my best, but she played unbelievable and I have to say congratulations to her.”