Rins' team mate Joan Mir finished third to take the Championship lead from pole-sitter Fabio Quartararo, who finished a disappointing 18th for Petronas Yamaha.
Starting 10th on the grid, Rins stormed out of the blocks to move up to fourth on the opening lap before moving past Yamaha's early pace-setter Maverick Vinales to take the lead on lap eight.
IWD special – 'Any sport should be equal' – FHO Racing boss on proving women belong in motorsport
Marquez, fresh off his maiden MotoGP podium finish in France last weekend, climbed up nine spots and tested Rins in the final five laps, but the Suzuki rider held his nerve to seal victory on home soil. (Reporting by Hardik Vyas in Bengaluru; Editing by Hugh Lawson)
Malaysian MotoGP testing cancelled due to pandemic
Local hope Oliveira takes pole for season-ending Portuguese MotoGP race