03Melt 3 tablespoons butter in an 8-inch heavy skillet over moderately low heat, then cook onion and garlic, stirring, until softened, 3 to 5 minutes. Add onion mixture to spinach along with salt, pepper, nutmeg, and cream and stir to combine.
04Put oven rack in upper third of oven and preheat oven to 400°F. Butter a 3-quart shallow baking dish (13 by 9 inches; not glass).
05Cut squash to separate bulb section from solid neck section, then cut pieces lengthwise into 1/8-inch-thick slices with slicer.
06Layer squash and spinach mixture in baking dish, using about one fifth of squash and one fourth of spinach for each layer, beginning and ending with squash. Sprinkle top layer of squash evenly with cheese and dot with remaining 2 tablespoons butter, then cover directly with a sheet of parchment paper. Bake until squash is tender and filling is bubbling, 25 to 30 minutes. Remove paper and bake gratin until browned in spots, 10 to 15 minutes, or broil 3 inches from heat, 2 to 3 minutes.