The 43rd-ranked Rogers recovered from a 5-2 deficit in the third set to push the affair into a tiebreak, securing the biggest upset of the tournament thus far in front of an electric New York crowd inside Arthur Ashe Stadium.
"I am stunned. My heart rate is still very much elevated. I'm very excited with that win," Rogers said, after defeating Barty for the first time in six meetings.
"Going on the court I told myself I didn't want to lose the same way I lost the last five times against her. I just tried to do things a little bit differently."
There were early signs of trouble for heavy favourite Barty, who handed Rogers a break with four double faults in the third game, and got fewer than half of her first serves in as she committed 17 unforced errors during the first set.
The Wimbledon champion found her form in the second set, getting a critical break in the fourth game with a forehand winner and again converting on break point in the sixth as Rogers whacked the ball into the net.
Up two breaks in the final set, Barty appeared poised to walk away with the win but couldn't hang on as her stellar 2021 crashed to an end.
An astonished Rogers held her hands to her face as she clinched the match, her mouth agape with surprise, the crowding rising to its feet.
"I was just trying to stay in the point longer than Ash. She was handling my pace really well tonight. I felt like the harder I hit the ball, the better she hit," said Rogers, the only American woman remaining in the tournament.
It was the second major upset of the women's tournament at Flushing Meadows, after 18-year-old Leylah Fernandez defeated four-time Grand Slam winner Naomi Osaka on Friday.
In the fourth round Rogers will face Britain's teen phenom Emma Raducanu, who hasn't dropped a set all tournament after reaching the fourth round of Wimbledon as well.
"I'm going to have to do a little bit of scouting I think. But she's fearless. She is playing very well and she's inspired. It's going to be a battle. I am ready for it," said Rogers.
'WOULDN'T CHANGE A THING'
Barty appeared to take the loss in stride, telling reporters afterward: "I (will) sleep well tonight knowing I gave everything I could."
"I played a pretty awful first set in the sense where I was erratic," she said. "I found a way back into the match, found a way to turn the match back in my favour, have a couple of opportunities to serve it out and be within a couple of points, disappointing not to get it done."
She said it wouldn't take long to move on, however, after a stellar 2021 in which she won five titles - including Wimbledon, Miami and Cincinnati - after taking an 11-month break from the tour last year as the COVID-19 pandemic swept across the globe.
She told reporters she planned to compete at Indian Wells next month, despite having been on the road for more than five months.
"I'm proud of myself and my team for all the efforts we've put in, in the last six months," said Barty.
"It's been pretty incredible. I don't think we could have asked for much more honestly. I wouldn't change a thing."