The Boston Marathon delivered a more than $500 million economic windfall to the Massachusetts economy this year.

That total reflects spending on lodging, food, shopping and entertainment by both participants and spectators as well as knock-on benefits to local businesses, according to a report released Thursday by the University of Massachusetts Amherst’s Donahue Institute.