Playing in her first Grand Slam since pulling out of the French Open earlier this year and disclosing her battle with depression, Osaka's return to Flushing Meadows did not go to plan, as she wordlessly left the court after uncharacteristically losing her cool in the second set tiebreak.
The third seed whacked her racquet and then flung it onto the court twice in frustration as Fernandez scored five straight points in the tiebreak, in a series of superb play.
Osaka did not receive a warning or a code violation and left the court between sets, later telling reporters she struggled to contain her emotions.
"I'm really sorry about that," she said. "I was telling myself to be calm, but I feel like maybe there was a boiling point.
"Like normally I feel like I like challenges. But recently I feel very anxious when things don't go my way, and I feel like you can feel that. I'm not really sure why it happens the way it happens now."
Her troubles continued as the 18-year-old Canadian broke her serve to kick off the third set, and Osaka hit a ball into the stands in the second game, prompting a warning from the chair umpire.
In the ninth game Osaka rushed through her serves, not even waiting for the crowd to quiet down, as she was unable to create a single break point opportunity in the final set.
A fan favourite, Osaka has struggled with uneven play since she withdrew from Roland Garros earlier this year amid a public row with tournament officials over required media appearances, which she said had a negative impact on her mental health.
She told fans that she has struggled with depression for years, prompting new discussion around mental health in professional sport.
"How do I go around saying this? I feel like for me recently, like, when I win I don't feel happy. I feel more like a relief. And then when I lose, I feel very sad, said Osaka.
"I don't think that's normal."
It was a breakthrough performance for Fernandez, who reached the fourth round of a major for the first time just a few days shy of her 19th birthday.
She fired off 28 winners across the three sets, and said in a televised interview that she worked at "just finding the solutions" during the match.
"She's a great server, she's been hitting aces left, right and centre," Fernandez said of Osaka.
She told reporters she was able to rely on in her own serve, as well, as she won more than three quarters of her first-serve points and fired off six aces.
"I've been serving really well the past few matches. Today I just went on court with a lot of confidence on my serve, trusting it, trusting that I'm going to hit my targets when I needed to, and I did," she said.
It was the second shock Alcaraz upsets Tsitsipas to reach U.S. Open fourth round upset of the evening at Flushing Meadows, after 18-year-old Carlos Alcaraz knocked world number three Stefanos Tsitsipas out in a five-set thriller.
Fernandez next faces 2016 champion Angelique Kerber of Germany.