In a medium mixing bowl, whisk together flour, ground ginger, cinnamon, baking powder, baking soda, allspice, and salt. Set aside.
Using a standing mixer or hand mixer, beat butter, sugar, and egg together until smooth.
Add molasses and vanilla and mix on medium until well blended.
Add dry ingredients in two increments, mixing on low between each addition, until evenly combined.
Divide dough in half (this makes it easier to roll out later) and wrap in plastic wrap.
Refrigerate dough for at least 2 hours and up to 24 hours.
When ready to bake, heat oven to 350 degrees F.
Spray a sheet pan with nonstick cooking spray (or use parchment paper or a baking mat.
Dust a work surface lightly with flour and roll dough out to about 1/4 inch thick. (Note: If the dough feels sticky, gently knead a bit more flour into the dough as you work until it easily rolls out.)
Cut into shapes and transfer to sheet pan.
If using M&Ms as decoration, press them into the cookies.
Bake until cookies are set, 10 to 12 minutes. (Note: If the cookies start to darken around the edges, take them out of the oven immediately; that’s a good sign they are done.)
Transfer to a wire rack to cool completely. Decorate as you’d like!