Amid a numbing succession of mass shootings, gun control groups outspent the National Rifle Association in the midterm election cycle, federal filings and additional reporting indicate, upending the usual order in the partisan battle over gun use.

Two groups that are focused on gun control, Giffords and Everytown for Gun Safety, spent at least $37 million at the state and federal level in the midterms, compared with at least $20 million by the N.R.A. The figures are incomplete, because some of the spending done by such groups is not required to be disclosed, but all sides agreed that the N.R.A. was outspent, stemming a trend of financial dominance for the N.R.A. going back years.

Despite being outspent in one election cycle, the N.R.A. remains a potent force in American politics. Much of the organization’s impact comes in its ability to mobilize millions of members, and it continues to wield a prodigious fund-raising and lobbying machine, and a hold on the Republican Party that will make any advancements of gun control a challenge.

But the N.R.A. has also arguably gained its most formidable counterweight since its emergence as a modern political force in the late 1970s.