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.): When you begin, you will notice a clean vegetal scent as you remove the tougher outer greens, and the pale centers will feel tender and almost sweet to the touch. Washing them in a bowl of water removes grit, and chopping them into small pieces creates uniformity so they cook evenly. This matters because abrasive grit can ruin the mouthfeel, and uneven pieces will lead to some bits remaining undercooked. A common mistake is not separating the layers to rinse thoroughly, which leaves dirt behind. If you hear a soft sizzle soon after adding them to the pan, you will know they are releasing their moisture properly.
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.: As the butter melts, it should foam briefly then settle, carrying the aroma of the leeks into the air with a sweet, almost nutty scent. Stirring occasionally ensures even softening and prevents browning too early, which would introduce a bitter note. This step matters because gentle cooking mellows the allium flavor and builds a savory base for the spinach . Avoid high heat, which will burn the leeks and impart an acrid smell.
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.: Add handfuls of the washed spinach , watching it collapse and hiss as it hits the hot pan. Replacing the lid traps steam and speeds wilting, while seasoning with salt , pepper , freshly grated nutmeg , and chile toward the end layers in depth of flavor. The visual cue is dramatic reduction in volume and a deepening green color. If you try to cram all the spinach in at once, it will steam unevenly and trap water, which can make the custard runny.
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.: Once the pot is emptied and the juices mostly evaporated, moving the mixture to a bowl helps it cool quickly, and stirring it a few times releases trapped steam. The tactile cue is that the mass will feel less hot and slightly drier at the surface. Cooling slightly makes pureeing safer and prevents the eggs from cooking when combined. A common error is blending while too hot, which can scramble the eggs and ruin the smooth custard texture.
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 (2 l).: Set your oven and prepare a buttered baking dish with at least 2 quart capacity, and you will sense warmth and a faint buttery smell from the greased pan. The high starting temperature helps the custard set from the edges inward, creating a stable structure. If the dish is too small, the batter will overflow, and if you skip thorough greasing, the pie can stick and tear when serving.
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.: Working in batches, pulse the cooled mixture with milk and beaten eggs until almost smooth; the blender will emit a steady whirr and the mixture will take on a uniform, glossy appearance. This blending creates an emulsion that yields a silky custard when baked. The reason this technique works is that it breaks down fibrous bits and incorporates air for lightness. A typical mistake is overfilling the blender with hot ingredients, which can create pressure and a messy eruption, so always leave headspace and pulse gently.
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.: Taste and adjust with a bit more salt and pepper if needed, then pour the batter smoothly so it fills the dish without bubbles. The liquid should have a thick, custard like flow and a muted green color. Grating Parmesan cheese over the surface forms a savory crust as it browns. If you skip tasting, you may end up with a flat pie, and uneven pouring can trap air pockets that create holes in the finished slice.
Bake until a knife comes out clean: As the pie bakes for about forty five minutes, you will see the center set and the edges pull slightly from the dish, while the top takes on a golden hue where the Parmesan cheese browns. The scent becomes richer, an interplay of baked dairy and roasted green notes. Testing with a knife in the center should yield a clean or nearly clean blade; if it comes out wet, bake a little longer. Opening the oven too often causes temperature drops that can prevent proper setting.