Casino companies and their supporters spent nearly $14 million in their successful campaign to defeat a ballot question on repealing the state’s casino law.

Campaign filings submitted this week show more than half of that spending — $7.6 million — came in the days leading up to the Nov. 4 election, thanks to major contributions from the state’s three licensed casino operators: Wynn Resorts, MGM Resorts International and Penn National Gaming.

That funding helped the Committee to Protect Massachusetts Jobs air thousands of television advertisements in the run up to the election.

Anti-casino activists spent roughly $650,000 on their efforts, with just $76,000 spent in the final days.

Voters, in turn, rejected the casino repeal question by a 20 percentage point margin.

The more than $15 million spent in the casino fight makes it easily the most expensive of this year’s four ballot questions. It also bests a $13 million record set in 2006 for a failed ballot initiative to allow wine sales in groceries, according to data from the state campaign finance office.

The more than $15 million in spending in the casino repeal battle approaches the highest combined total for ballot question spending in Massachusetts, according to the state campaign finance office.

That $16.1 million spending record was set in 1992, when four questions were on the ballot, including ones dealing with recyclables, tobacco education, taxing hazardous waste and public disclosure of certain corporate tax records.

By comparison, Republican Charlie Baker and Democrat Martha Coakley spent a combined $7.5 million in this year’s closely-watched governor’s race. (That contest, however, also drew some $17 million in spending from so-called super PACs and outside political groups.)