Bagnaia and Marquez locked horns with each other in the latter stages of Sunday's 25-lap grand prix at Jerez after early leader Jorge Martin crashed out.
Marquez chopped down a 1.2-second advantage Bagnaia held on lap 14 to get within striking range on the 21st tour.
As Marquez threw his Gresini Ducati up the inside of Bagnaia, he ran slightly wide and on the cutback into Turn 10 the pair rubbed against each other.
Bagnaia came out on top and defended another overtake attempt on lap 22 to hold on for the victory.
Despite the pair colliding at the Portuguese GP last month, Bagnaia says he enjoyed his battle with Marquez and felt the contact they made was done "in a smart way".
"I enjoyed the fight a lot," he told motogp.com's After the Flag. "For sure, you know when you fight Marc you have to put your elbows up because the fight is intense.
"Honestly, it was the only place I was able to defend because I was knowing perfectly that he was very strong in corner seven and eight and I was hearing every lap that he was closing the gap.
"But I was really strong in the entrance of corner nine. So, I was saying to myself 'OK, I won't take a risk in corner eight but I will break so hard in corner nine to have a little advantage'.
"And I knew that if I was braking this hard, he was for sure going to go a bit wide. And I just used this thing to close the line and be in front again.
"When you fight like this, you put it on the list that you can have this contact. I thought it was quite smooth and smart, because I was on the inside.
"He just tried to go around me, but as soon as we arrived to the apex we touched.
"He picked up [the bike] a bit; I just leant more because if I picked up too, I was going on the other side. So, it was contact but in a smart way."
Prior to Martin's crash, Bagnaia was set to fall 47 points behind his Pramac rival but is now just 17 adrift.
And during his battle with Marquez, he admits he had no thoughts of settling for second in order to minimise a points loss.
"It's too soon to start thinking about it [the title], and as soon as Jorge crashed I felt better with the bike and I started to push and I dropped the lap times a bit," he added.
"So, no, I never thought about giving up and taking second position. I'm not a guy who in this kind of moment likes to give up."