Preheat the oven to 190°C. Heat 1 tablespoon of the oil in a frying pan, then add the onion and garlic. Cook gently on a low heat, stirring occasionally, for about 8 minutes, until softened. Add the spinach and tomatoes and continue cooking for about 6 minutes. Tip into a large bowl and allow to cool slightly.
Stir the ricotta and feta cheeses into the spinach mixture together with the pine nuts and season to taste with a little salt and pepper and the nutmeg.
Lightly oil a shallow baking dish measuring about 28 × 20 cm. Use two of the filo sheets to line the base and sides of the dish, overlapping if necessary. Leave the excess pastry to hang over the edges of the dish. Cover with half of the spinach mixture, spreading it out to the edges in an even layer. Cover with two more sheets of filo, then another layer of the spinach.
Fold the excess filo in over the top, then place the remaining two filo sheets on top, folding the edges under neatly. Brush the top lightly with the remaining oil and bake for 25 minutes or until crisp and golden.