Sharapova has struggled for fitness since her 15-month doping ban that ended in 2017.
Sharapova has been struggling back to top fitness since watching from the sidelines during her 15-month doping ban that ended in 2017.
The diminutive Barty, 22, has been in sizzling form, winning seven of eight matches this year to back up a title victory in Zhuhai late last year.
Sharapova's win sets up a last 16 clash with in-form Australian hope Ash Barty for the 31-year-old, who won the title at Melbourne Park in 2008 and has reached the final a further three times.
Sharapova, who is seeded 30th at the tournament and seeking to recapture former glories after coming back from a drugs ban in 2017, brushed aside Swede Rebecca Peterson 6-2, 6-1.
Rafael Nadal is bidding to become the first man in the Open era, and only third in history along with Roy Emerson and Rod Laver, to win each Grand Slam on two or more occasions.
The only break point Sharapova faced was when she double-faulted in the fifth game of the second set.
Maria Sharapova was knocked out of the US Open in the fourth round on Monday, losing 6-4, 6-3 to Spanish birthday girl Carla Suarez Navarro.
Sharapova, the 2006 champion who was trying to reach the quarter-finals for the first time since 2012, hit 38 unforced errors and dropped serve six times.
Sharapova is now undefeated in 22 night matches at the Billie Jean King National Tennis Center.
The former world number one, who beat Swiss veteran Patty Schnyder in the first round, has never lost a night session match at Flushing Meadows in 22 attempts.
Sharapova let a big second-set lead slip away, then needed four match points to close out Schnyder 6-2, 7-6 (6).
Serena Williams is ranked 183 after her pregnancy absence and French Open chiefs decided against seeding her.
Now ranked 24 in the world, Sharapova heads to Wimbledon without any competitive grasscourt action.
Former world number one Williams, a three-time champion in Paris, is playing a Grand Slam for the first time since winning the Australian Open in 2017.