Cook the spinach: Heat a large skillet over medium heat, and add a tablespoon of olive oil. If using fresh spinach, sauté it until wilted (around 2-3 minutes).
Drain any excess moisture and chop the spinach finely. If using frozen spinach, make sure it’s thoroughly drained and chopped.
Sauté the aromatics: In the same skillet, add another tablespoon of olive oil, followed by the chopped onion, green onions, and garlic. Cook until the onions are soft and translucent, about 5 minutes.
Mix the filling: In a large mixing bowl, combine the spinach, sautéed onions, garlic, feta cheese, ricotta (if using), eggs, fresh dill, salt, pepper, and nutmeg. Stir until well incorporated.
Step 2: Layer the Phyllo DoughPreheat the oven: Set your oven to 350°F (175°C) to preheat while you work. Prepare the phyllo dough: Phyllo dough dries out quickly, so work fast and cover it with a damp cloth while assembling the spanakopita. Lightly brush the bottom and sides of a baking dish with melted butter or olive oil.
Layer the dough: Place a sheet of phyllo dough in the baking dish and brush it with melted butter. Repeat this process with about 8-10 layers of dough for the base, making sure each layer is brushed with butter.
Step 3: Assemble and BakeAdd the filling: Spread the spinach and feta mixture evenly over the layered phyllo dough. Top with more dough: Continue layering phyllo sheets on top of the filling, brushing each sheet with melted butter as you go. Aim for another 8-10 layers for a perfectly crispy top.
Score the top: Using a sharp knife, lightly score the top of the dough into squares or triangles. This will make cutting easier after it’s baked.
Bake the spanakopita: Place the dish in the preheated oven and bake for 45 minutes or until the top is golden brown and crispy.
Cool and serve: Let the spanakopita cool for about 10 minutes before slicing and serving.