Preheat the oven to 400°F.
If you are using fresh spinach, blanch it first. Bring salted water to a boil. Drop the spinach into boiling water for 15 to 30 seconds until it turns bright green. Remove the spinach and immediately plunge it into ice water to stop the cooking process. Thoroughly squeeze the excess water from the spinach.
In a large, heavy-bottomed pot or Dutch oven, heat the olive oil (it should be enough to cover the bottom of the pan) on medium heat. Add the onion and sauté it, stirring occasionally, until it turns translucent, about 2 minutes.
Add the frozen spinach and stir it with the onion, cooking it until it is thawed but not hot. If you’re using fresh spinach, heat it through until it wilts (about 1 minute).
Transfer the onion and spinach to a colander. When it is cool enough to handle, squeeze it with your hands or press with a spoon to extract as much water as possible. Set the mixture aside to cool completely.
Crumble the feta into a large bowl, add the eggs, and stir well. Add the dill, then salt and pepper to taste. Add the spinach and onions and combine well.
To make individual triangles: Brush one or two sheets of phyllo with melted butter. Fold the sheets lengthwise twice (so they are long and thin-shaped), and place a heaping teaspoonful of the spinach mixture at one end in the corner of the dough. Then fold the dough into a triangle over the spinach mixture, creating a little pocket. Repeat folding the pocket of spinach until no more dough remains to fold. (There may be a little flap of dough left, which you can cut off with a knife.)
A much easier method is to make a spanakopita casserole: Using scissors or a sharp knife, cut the sheets of phyllo so that they will fit into a 9-by-13-inch baking pan or Pyrex dish. Brush each sheet with butter; continue this until you’ve used up half of the sheets (8 to 10), and lay them flat in the bottom of the dish. Add the spinach mixture and gently spread it into an even layer. Then stack the rest of the sheets on top, buttering each one as you go.
Score the layers of phyllo before baking—otherwise it will be very hard to slice, as it gets so flaky. Bake the casserole for about 25 minutes; if you’ve made the triangles, bake them on a greased baking sheet for about 15 minutes. Check often—spanakopita is ready when the dough is golden brown; if it gets too dark, it is overdone.