Williams, bidding for a record sixth Key Biscayne title, avenged a loss to Stosur when they last met in the US Open final in September.
Seeded 10th, Williams is playing in her first tournament since January after being sidelined by a left ankle injury. She hit 20 aces and lost only six points on her first serve, but she had to rally after being broken in the first game of each set against the No. 6-seeded Stosur.
Williams is seeking her first tournament championship since August.
Williams started slowly, failing to convert her first seven break-point chances, but once she pulled even, her serve repeatedly got her out of trouble.
She hit three aces during a marathon game to hold for 3-2 in the second set. After falling behind love-40 in the final game, she smacked her last two aces and then a tricky second serve that kicked six feet high to handcuff Stosur and give Williams the final point.
"I'm really trying so hard," she told the crowd. "My mom gave me the ultimate pep talk last night, so thanks, Mom."
Her sister Venus was to face Ana Ivanovic in the fourth round Monday night. Venus is playing in her first tournament since withdrawing from the US Open last August after being diagnosed with a fatigue-causing autoimmune disease.
"Venus has been so motivating, doing so well," Serena said.