Chilling cookie dough before baking solidifies the fat in the cookies. As the cookies bake, the fat in the chilled cookie dough takes longer to melt than room-temperature fat, which helps keep the cookies from spreading.