Mechanically, it works on any of your attack rolls.
The description poses no restrictions except that the attack must be yours. Melee, ranged, and spell attacks are affected. Other creatures are not affected, i.e. a monster's attack roll can never be affected unless the monster is the amulet's wearer for some reason. Also, not all damaging spells let you make an attack roll. Those that do, say so.
Lorewise, Mechanus's laws are all-encompassing.
The lore on Mechanus (DMG p. 66, and description of Modrons MM p. 224) state multiple times that it is a plane of absolute law and order. There is also no specific reason why spell attacks would be unaffected and the descriptions suggest that the rules of Mechanus do not include arbitrary exceptions. As as aside, the amulet's effect is an adaptation of the Law of Averages (DMG p. 66) which now applies to attack rolls instead of damage rolls. The description of the Law of Averages also specifically includes spell damage.