However her class and experience told in the end, as the 38-year-old prevailed 6-3 6-4 in 96 minutes.
"It feels good," said Williams. "It's been a long time. I've been waiting two years for this moment. I think you could see the relief on my face. I played an incredible opponent in Jessica and honestly it was a great match, I couldn't have played anyone better in this final."
In a touching gesture, Williams revealed she donate her entire prizemoney cheque of US$43,000 to the Australian bush fire appeal.
"I've been playing in Australia for over 20 years and it's been really hard for me to watch all the news and everything that has been happening with all the fires," she said.
"Over a billion animals and people that have lost their homes. So much has happened, so I decided at the beginning of the tournament in every match I played I'd donate a dress and I'd also donate all my prizemoney for a great cause."
The result completes a magical week for the American, and the tournament. She revealed last Sunday that she felt obliged to come back to Auckland, as her unhappy time here in 2017 was "where it all began", as she unknowingly played the first tournament since falling pregnant.
If she wanted redemption here, she got it in a big way. She has been popular around the event, creating a buzz wherever she went, and poured her heart and soul into her endeavours on the court, in both singles and doubles, and played on all seven days, a rare feat.
Williams improved significantly across the week, but it has rarely been straightforward, aside from the semi-final demolition of Amanda Anisimova. She dropped a set to Christina McHale in the second round, and battled blustery conditions in first two rounds.
But she worked hard, never stopped fighting and at times looked unstoppable.
"I was definitely improving as the week went on and obviously I needed to," said Williams. "I feel like I had a lot of tough matches and I played every day."
Williams took a while to get going on Sunday. She dropped her first service game, eschewing two game points, which stretched over five minutes. After Pegula held, the pattern continued, with Williams fending off four break points to avoid a 0-3 deficit, showing her relief with a huge, Lleyton Hewitt style 'C'mon!
Williams was trying to fire herself up, willing the mind to inspire the body, but World No 83 Pegula was equal to everything, impressing with her fearless approach.
Her movement was superb, her shot selection astute, and unlike the other players this week, the 25-year-old could live with the pace that Williams was generating.
But Williams finally enjoyed a convincing hold for 2-3, signalling a subtle shift in momentum, with consecutive breaks.
The crucial moment came at 4-3 in the first set. After missing three, Williams set up her fourth break point with an athletic retrieval of a drop shot. She prevailed in the next rally, with a superb backhand winner down the line, before turning to face the Robinson Stand, arms raised in the air.
Williams looked exhausted from her exertions, but had done enough, and converted her second set point minutes later.
It should have been downhill from there, but Pegula, who only won her WTA title in Washington D.C. last year, refused to succumb easily.
She defended four break points in the first game of the second set, but was broken at her next turn from the line.
Williams maintained her advantage, but Pegula defied her inexperience in finals with a gutsy display, particularly serving a 3-5 down, when she faced three championship points and saved them all.
Williams was bringing her full arsenal, from forehands that defied physics to delicate drop shots, but Pegula was equal to the task.
But Williams wasn't going to be denied, and a winner down the line cemented her 73rd title, and first that daughter Olympia has witnessed.