MIAMI, FL, USA - She was given a stern challenge in her first match, but as she has so many times before at the Miami Open, Serena Williams found a way to win.

The No.10 seed and eight-time champion opened up her campaign at this year's event with a 6-3, 1-6, 6-1 second round victory over World No.63 Rebecca Peterson inside Hard Rock Stadium on Friday. 

After retiring with a viral illness against Garbiñe Muguruza at the BNP Paribas Open last week, Williams scored her first win in three years at what is ostensibly her home event, where she last raised the trophy in 2015.

"I'm not really thinking about my match too much today. I wasn't really happy with my performance. I had to take a lot of time off the last week," she said after the match. 

"It's definitely not easy at all, but I'm through it. That's that. I just got to get my game back to where I know it can be."

After being served a surprise breadstick in the middle set by the 23-year-old Swede, Williams saved the lone break point she faced in the decider in the opening game before coming through in one hour and 37 minutes. 

Overall, the American hit 27 winners to 23 unforced, forcing herself to earn victory against a steady Peterson who hit 15 winners to 18 unforced errors.

After landing just 33 percent of her first serves in the second set, which allowed Peterson to utilize her heavy forehand to great effect to gain the upper hand in the rallies and break twice, the 23-time Grand Slam champion served five of her nine aces in the final set.

"I could not lose this match. I knew that I could play a lot, lot, lot better. I just had to be better," she said. 

"That determination was, I cannot lose this match just really kicked in. 'What do I need to do to win this match?' 

Williams won the first three games and the last three games of the decider to deny the Swede's upset bid and advance to a third round meeting with No.18 seed and Chinese No.1 Wang Qiang.

"What was a little frustrating today is I know I can play so much better, but I just wasn't able to produce it today," Williams added.

"But that's the beauty of fighting, getting through the matches where you're not playing your best, then coming out the next time and just doing better."