Sharapova hadn't played in a major tournament since the Australian Open in January 2016, when she tested positive for the newly banned drug meldonium. She served a 15-month ban for that, returning to the tour this April with a ranking too low to get into Grand Slam events.
The French Open denied her a wild-card invitation, then she planned to try to qualify for Wimbledon before pulling out because of an injured left leg.
But she was able to enter the U.S. Open thanks to a wild card from the U.S. Tennis Association, which then proceeded to put its 2006 champion in Arthur Ashe Stadium every time she played over the past week, drawing strong support from spectators - and criticism from another former No. 1-ranked woman, Caroline Wozniacki.
Sevastova made Sharapova run a lot by pulling her forward with drop shots or tight angles, then would often deposit follow-up strokes into open spaces. On one point won by Sharapova in the second set, she twice tracked down lobs that she got back over the net by hitting the ball left-handed.
But she could not sustain enough strong play, and Sevastova advanced to the U.S. Open quarterfinals for the second consecutive year.
That's where she will face unseeded American Sloane Stephens, who reached her first quarter in New York by eliminating No. 30 Julia Goerges 6-3, 3-6, 6-1. Stephens has won 12 of her past 14 matches, a remarkable run for someone who was off the tour for 11 months because of foot surgery in January.
Earlier today, 18-year-old Canadian Denis Shapovalov's entertaining stay ended with a 7-6 (2), 7-6 (4), 7-6 (3) loss to 12th-seeded Pablo Carreno Busta of Spain.
Shapovalov was trying to become the youngest male quarterfinalist at Flushing Meadows since Andre Agassi in 1988, but he wasted a 5-2 lead and three set points in the opener, and finished with 55 unforced errors.
"Honestly, it was so much fun to be part of that atmosphere and the match and this whole two weeks," Shapovalov said. "You know, it's another life-changing event for me."
Carreno Busta, meanwhile, is the first man to ever face four qualifiers in a row at any Grand Slam tournament and took full advantage. He is the highest-seeded player left on his side of the draw and faces No. 16 Lucas Pouille of France or No. 29 Diego Schwartzman of Argentina next.
In other fourth-round matches later today, No. 17 Sam Querrey, the only American man left, was scheduled to face No. 23 Mischa Zverev of Germany, and No. 8 Kevin Anderson of South Africa met unseeded Paolo Lorenzi of Italy.