Drain spinach in a colander and squeeze out as much liquid as possible, set aside.
In a skillet over medium heat, add oil and when it gets hot, add onions and sauté until translucent, about 3 minutes. Add garlic and sauté for only 1 minute before adding drained spinach. Stir it into the onion mixture and cook for 2 minutes, breaking it into small pieces. Add cheeses and stir until well combined. When the cheeses start melting, about 2 minutes, remove from the heat and transfer to a large bowl. Add dill, lemon juice, salt and pepper. Mix the ingredients and set aside to cool, about 30 to 40 minutes.
When the spinach mixture is at room temperature, add beaten egg and stir until well incorporated. Place cling film on top making sure it touches the surface and transfer to the fridge to chill, about 1 hour.
Preheat oven to 350ºF.
Place the 12 sheets of phyllo on a parchment paper to prevent it from sticking to the counter. Gently grab one sheet and lay it on the counter. Place a damp clean dish towel on the other phyllo sheets to prevent them from drying out.
Brush some melted butter on the sheet, covering the entire surface before placing another sheet on top (always cover the remaining sheets with the damp towel). Smooth it out, pressing down so the sheets stick together. Cut 4 equal strips using a pastry cutter. Place 1 tablespoons chilled spinach mixture at one end. Roll to the other end while folding in the sides. When done rolling, brush on some more melted butter to seal.
To make triangles, place 1 tablespoons chilled spinach at one end. Grab one corner and fold it over the filling to the other side keeping it in line with the edge. Take the triangle and fold it forward before folding it over to the other side – keep doing this until you reach the end. To seal, just like with the rolls, brush on some melted butter, flip it over and gently press down.
When done making rolls or triangles, place them, seam side down, on a baking sheet lined with a silicone mat or parchment paper. Transfer to the preheated oven and bake for 22 to 25 minutes or until golden brown. If there are some that are getting brown sooner, simply remove them from the heat. Makes 24 spanakopita.