Preheat the oven to 350°F. Heat two tablespoons of olive oil over medium heat in a large skillet and add the onions, green onion, and garlic.
While the onions and garlic cook, whisk together the ricotta and Parmesan cheese with the eggs. Add the lemon juice last and stir to combine.
When the onions are translucent and the garlic is fragrant, add the spinach. Use a wooden spoon to stir the spinach until it has wilted to about a fourth of the original size. Season with salt and pepper, then remove from the heat and let cool for five to ten minutes, or until no longer steaming on top.
Stir the spinach mixture into the egg and cheese mixture. Fold the spinach into the cheese until it is completely covered.
Roll out the phyllo dough, keeping what is not being used covered with a damp towel. Take two sheets of dough and lay them on top of each other. Brush with olive oil to the edges.
Fold the phyllo in half and place 3-4 tablespoons of filling in the top center. Fold the dough, corner over filling, alternating sides, until a triangle has taken shape. Fold in the edges as you work then brush the outside with olive oil.
Arrange the spanakopita on a baking sheet lined with parchment paper. Bake for 15-20 minutes or until the spanakopita is golden brown.
Serve warm or at room temperature. Store leftovers in the fridge for up to 3 days. Enjoy!