Preheat the oven to 180°C (350°F).
Heat olive oil in a pan over medium heat. Add the onion and sauté until translucent.
Add the spinach to the pan and cook until wilted. Remove from heat and let cool slightly.
In a large bowl, combine the cooked spinach, feta, and beaten eggs. Season with salt and pepper.
Layer the phyllo pastry sheets in a baking dish, brushing each layer with olive oil.
Pour the spinach mixture over the phyllo and spread evenly.
Fold over the edges of the phyllo to enclose the filling.
Bake in the preheated oven for 45 minutes or until the pastry is golden brown.
Remove from the oven and let cool slightly before serving.