Trim away the very dark green part of the leeks. Slice each leek lengthwise, rotate them a quarter turn, then slice them lengthwise again, keeping the end intact. Swish the leeks in a bowl of water until they’re grit-free, then towel dry. Chop into small pieces. (If substituting onions or scallions, prepare them as directed in the ingredient list.)
Melt the butter in a deep skillet or shallow pot that has a lid and sauté the leeks with a little salt and pepper, stirring occasionally, until they’re translucent. While the leeks are cooking, cut the spinach into smaller pieces.
Once the leeks are cooked, begin adding the spinach in batches, replacing the lid until the spinach in the pan has cooked down, and there's room to add more. Season lightly with salt and pepper as you go, and include a big pinch of freshly grated nutmeg and chile powder during the final batch.
When all the spinach has wilted and most of the juices have evaporated, transfer it to a bowl or platter and let cool. Stirring it a few times will speed it up.
Preheat the oven to 400ºF (200ºC). Liberally butter a round or rectangular baking dish with high sides, with a capacity of at least 2 quarts (2l).
Working in batches, puree the cooked spinach mixture with the milk and eggs until almost smooth with a blender or food processor. Season with salt and pepper, if desired.
Pour the batter into the prepared baking dish. Grate a layer of Parmesan over the top and bake for 45 minutes, or until a knife poked into the center comes out clean.