Suzuki rider Rins held off a ferocious challenge from Italy’s Valentino Rossi over the closing stages to take the chequered flag at Austin’s Circuit of the Americas in Texas.
Australia’s Jack Miller on a Ducati finished third.
Rins’ maiden win brought Honda rider Marquez’s long reign of dominance in Austin to an end.
Marquez, who started on pole, had scored six consecutive victories in the Texan city heading into this weekend’s event, the third leg of the 2019 MotoGP World Championship.
But his challenge ended when he crashed on turn 12 of the ninth lap while leading.
Rins meanwhile was left to celebrate after becoming the first man to win in Texas in all three categories. He won the Moto3 race in Austin in 2013 and the Moto2 event at the circuit in 2016.
“I am so happy I don’t have words to describe how I feel. When I crossed the finish line my emotions exploded,” the 23-year-old said afterwards.
“Suzuki has done a great job, and created a wonderful motorbike. And to beat Valentino, who was my idol when I was a kid, is incredible for me,” he added.
Italy’s Andrea Dovizioso, who finished fourth on Sunday, moved to the top of the overall standings with 54 points, followed by Rossi (51), Rins (49) and Marquez (45).
“I’m sorry I couldn’t get the win,” Rossi said afterwards. “When I saw that Marquez had fallen, I thought it was possible. But in the end Rins was just too good.
“It’s a shame because I have not won in a long time but we will keep trying,” added Rossi.
Earlier, Marquez had looked to be surging towards a seventh straight win in Austin after rapidly opening up a decent gap from his pursuers.
But with Marquez three seconds clear after completing eight laps, disaster struck when he fell, leaving Rossi in the lead.
Rins meanwhile gradually closed on Rossi and overtook the Italian with four laps to go.
That set the stage for a thrilling duel over the closing stages, before Rins held on to cross first.
Earlier, Switzerland’s Thomas Luthi of the Kalex team won the Moto2 race, finishing ahead of Germany’s Marcel Schrotter in second and Spain’s Jorge Navarro in third.
In the Moto3 event, Aron Canet took the line honours after taking advantage of a late crash from Japan’s Tatsuki Suzuki.
Suzuki had looked poised to claim first but crashed with five laps to go to allow KTM rider Canet to take the honours.
Canet completed the 17-lap race in 39min 6.761sec, with compatriot Jaume Masia finishing second and Italy’s Andrea Migno third.
Download our app and read this and other great stories on the move. Available for Android and iOS.