WASHINGTON — The day after the massacre last month in San Bernardino, Calif., Senate Democrats, sensing an opportunity, rushed to pass a measure denying guns to anyone on the no-fly terrorism watch list. The timing of the vote and the nature of the bill gave them reason to hope that they could, for once, thwart the gun lobby.

But Chris Cox, the National Rifle Association’s brash and boyish-looking chief lobbyist, was ready for them.

Mr. Cox and more than a dozen N.R.A. lobbyists under him buttonholed Republican senators in a flurry of meetings, calls and emails, officials said. And in a message on Twitter, they directed the N.R.A.’s five million members to “call your senators NOW and urge them to vote NO on any and all #guncontrol proposals.”

“It was all hands on deck,” David Keene, an N.R.A. board member, said. With the country jittery about guns after 14 people were killed in San Bernardino, he said in an interview, “we needed to find out whether these senators were with us or not.”