Combine the canned tomatoes, quartered onion and butter in a medium pot and bring to a gentle simmer.
Simmer the sauce gently for about 45 minutes, then blend until smooth and season with salt and pepper to taste.
Preheat the oven to 180°C (350°F).
When the sauce is nearly finished, cook the gnocchi according to the package instructions in salted boiling water until they float (about 1–2 minutes).
About 1–1.5 minutes before the gnocchi are done, add the spinach to the pot and cook until wilted, then drain gnocchi and spinach in a colander.
Stir the cream or crème fraîche through half to three-quarters of the blended tomato sauce, then add the finely sliced basil (or pesto) and mix to combine.
Transfer the drained gnocchi and wilted spinach to an ovenproof baking dish and fold in the creamy tomato‑basil sauce until evenly coated.
Slice the fior di latte and distribute the pieces over the surface, then sprinkle the grated Parmesan evenly on top.
Bake for about 25–30 minutes, until the top is golden and the dish is bubbling.
Serve immediately, garnished with a few extra spinach leaves and additional Parmesan if desired.