McGonagall had worked in Magical Law Enforcement for two years before becoming a professor and perhaps had received the specialized post-Hogwarts training given to Aurors, as indicated by Nymphadora Tonks to Harry Potter (at the beginning of the 5th book).
She was a child prodigy at magic, as we read in her wiki-bio: “She had no control of her magic and thus inadvertently summoned toys that had been left on upper shelves to her cot, made the family cat do her bidding, and her father's bagpipes play themselves which would cause her to chuckle happily.” —Minerva McGonagall
She was very athletic and played for the Gryffindor Quidditch team during her days at Hogwarts. Practicing quick reflexes, dexterity, fearlessness in the face of danger, and stamina translate well to dueling.
…speaking of which, she likely was in dueling club in her day and excelled; whatever happened to this club we don't know, but Flitwick was a dueling champion in his day, and Lockhart probably got the idea from his own school days.
In addition, she just happens to be “rather good at magic” (she told Harry with dry understatement just before the battle), probably being a master spellcaster only second to the likes of Grindelwald, Dumbledore, and He-Who-Lost-His-Nose, and at least equal to Snape, Flitwick, Slughorn, and Bellatrix Lestrange.