Oh, boy;
this again. Rey is not a Mary Sue. That was DOA back in 2015. However, focusing on the saber duel, that was justified in context by everything that came before it in the film.
First of all, in the Jakku scenes, it's established that Rey has some skill in melee combat with her staff (in fact, watch the duel closely; you can she she's trying to use the saber like a staff early on). She's not a total newbie to this (even if lightsabers are new to her). She's fighting Kylo, who is injured and not in good shape (he was shot in the gut with a bowcaster that packed the punch of a mini rocket launcher and slashed across the shoulder of his sword arm); this can be actually be seen, as the longer the duel goes on, the sloppier he gets. His wounds and worsening state level the field a bit to her inexperience.
Also important, Kylo was trying to take her alive. She wasn't facing him fighting at full force, both in terms of his health and in his using the full extent of his abilities. Even more important, Rey spends the majority of the duel retreating and on the run. She's doesn't have a good offense and her defense is mostly related to her being a quicker runner in comparison to the injured Kylo. The tide doesn't turn until she's able to access the Force and use that to gain an advantage. Only then does she start making effective attacks and actually gaining ground, even giving Kylo a few more injuries.
Finally, most importantly, even then, when she has the Force on her side and Kylo is starting to really feel the effects of his wounds,
Kylo still almost wins (the scuffle where they're fighting for control of the sabers -- going on after Kylo got his leg wound and is exerting his wounded arm). This wasn't a one-sided match for Rey; she didn't utterly beat Kylo; she was able to escape by the skin of her teeth because Kylo was in terrible shape and not trying to kill her. Nothing Mary Sue about that and the Chekov's guns were loaded, mounted and fired to give us this outcome. Boom! (Insert mike drop here.
![Big Grin](images/smilies/biggrin.png)
)