Preheat and Prep: Preheat your oven to 350°F (175°C). Grease a 9x13-inch baking dish or a similar-sized baking tray.
Cook the Spinach: In a large skillet, heat the olive oil over medium heat. Add the chopped onion and garlic, and sauté until fragrant and translucent, about 5 minutes. Add the spinach and cook until wilted and any excess moisture has evaporated. If using frozen spinach, just cook until heated through. Remove from heat and let it cool slightly.
Mix the Filling: In a large bowl, combine the cooked spinach mixture, feta cheese, ricotta cheese, Parmesan cheese, eggs, and dill. Season with salt and pepper to taste. Mix well until everything is evenly combined.
Layer the Phyllo: Carefully unroll the phyllo dough and cover it with a damp towel to prevent it from drying out. Place one sheet of phyllo dough in the bottom of the prepared baking dish, and brush lightly with melted butter. Repeat this process, layering and buttering each sheet, until you have about 8-10 sheets layered.
Add the Filling: Spread the spinach and cheese mixture evenly over the phyllo layers.
Top with Phyllo: Continue layering the remaining phyllo sheets on top of the filling, brushing each sheet with melted butter as you go. Make sure to tuck in the edges to create a neat finish.
Bake: Using a sharp knife, score the top layers of phyllo into squares or diamonds to make cutting easier after baking. Bake in the preheated oven for about 45-50 minutes, or until the phyllo is golden brown and crispy.
Cool and Serve: Allow the Spanakopita to cool for a few minutes before cutting into pieces. Serve warm or at room temperature, and enjoy the rich, savory flavors of this Greek classic.