The 30-year-old sixth-seeded American, who lifted her maiden Grand Slam trophy in Melbourne in January, made a staggering 89 unforced errors with 14 double faults and became the highest seed to exit the women's draw at the year's final major.
"I'm just very happy obviously coming in to the match I was like almost crying because I was really nervous but I think the crowd made it so chill for me ... thank you guys, for staying," Zarazua said.
"I know my game is a bit tricky so sometimes people get a bit bored ... We don't have many tennis players as you can see but I had some Mexico players from doubles cheering for me. I could hear some Mexican cheering so that was very nice."
Spurred on by the home crowd, Keys battled from 2-4 down in the opening set and clinched it in a tense tiebreak after saving five set points and she let out a huge roar to loud cheers on a sunbathed Arthur Ashe Stadium.
The 2017 runner-up composed herself in the second set and raced ahead 3-0 but Zarazua was not done and mounted a strong fightback by winning the next five games.
Keys unleashed a huge forehand winner to go level after 10 games, but the sixth seed continued to waste her opportunities and allowed Zarazua to force another tiebreak and prolong the error-riddled but enthralling contest.
There was little to separate the duo in the decider before Zarazua surged to a 5-3 lead and then staved off a comeback attempt from Keys to prevail in three hours and 10 minutes.
Meanwhile Petra Kvitova's professional tennis career has ended after the two-time Wimbledon champion was eliminated in the first round by Diane Parry 6-1 6-0 in just 52 minutes.
Parry's reward is a second-round tie with Zarazua.
"I hoped I would put on a better show today," said Kvitova, a 35-year-old left-hander from the Czech Republic who had announced this appearance at Flushing Meadows would be her last tournament.
After it ended when she sent a backhand return wide, Kvitova began crying. She went over to the stands for a hug and a kiss from her husband, Jiri Vanek, who is also her coach.Â
They became parents in July 2024, when their son, Petr, was born, and Kvitova returned to the tour this season after a 17-month break.
She announced earlier this year that she would be retiring after the US Open.
Kvitova won Grand Slam titles at Wimbledon in 2011, defeating Maria Sharapova in the final, and 2014, with a victory over Eugenie Bouchard, and was ranked as high as No.2.
In December 2016, she was stabbed at her home by a knife-wielding intruder. Kvitova needed hours of surgery to repair nerves and tendons in her racket-holding left hand.
She returned to competition less than six months later at the French Open, where she won her first match back.
Two-time Grand Slam champion Barbora Krejcikova beat Canadian Open winner Victoria Mboko 6-3 6-2.