A dominant Williams sailed through the first set at Arthur Ashe Stadium, closing out the first game with one of seven aces on the match before breaking her unseeded opponent’s serve on the second game to take an early 2-0 lead.
The 38-year-old American showed little sign of weakness, aside from a single double fault and a trio of unforced errors, as she finished off the set in just 35 minutes.
Momentum shifted during the second set, however, as Gasparyan, 26, went on the offensive and the six-time champion committed four double faults.
The unseeded Russian drew Williams to the net and sent a forehand pass winner whizzing by her, before forcing her into an error on the next point to break her serve and narrow the lead 3-2.
Williams retaliated, breaking her serve, but Gasparyan refused to back down, eventually leveling the score 4-4.
Williams, a crowd favourite who this year must play without her legions of fans cheering her on, clawed her way back, managing to close out a lengthy 16-point game to hold her serve and retake the lead before closing out the match.