Concert ettiquette

So I don't go to a lot of concerts but I got invited to one last minute by someone who had an extra ticket. The venue was all dancefloor in front of the stage and there was a small amount of lounge seating among the perimeter. It was before the opener and the DJ was playing, my friend and I were dancing a couple people away from the stage.

I feel this girl pressing up on me so I keep dancing and press back a bit so I actually have space to dance. She keeps doing it so I continue to dance as if she wasn't there which means I'm still pushing back a bit so I have space, I figure I can deal with her pushing up on me and if she doesn't like it she'll move. To me it was obvious what I was doing, I probably should have communicated with her verbally but I figured she can do whatever, I'm gonna keep dancing. After a while her friend taps me on the shoulder and asks me to “Mind my personal space.” I turned back towards the stage roll my eyes at the friend that I came with to indicate that the girls were outta line, but obliged by reverting to much duller side-to-side type dancing.

So I’ve been thinking about this since, especially since the friend wasn’t particularly rude or anything, was I actually out of line here? Who has the “right of way” in this situation? Should she have made room for me to dance? Or should I have made room for her to stand? Does it matter that it was before the opener? Or how close to the stage we were?

Like I said I haven't been to many concerts so I don't know what the unwritten rules are.