Cook the pasta in a large saucepan of salted boiling water according to the packet instructions until al dente. Drain, refresh in cold water, then drain again thoroughly.
Meanwhile, make the filling. Put the ricotta in a large bowl and break up with a fork. Stir in the garlic, half the Parmesan, the basil and spinach. Season generously with salt and pepper and use this mixture to stuff the pasta shells.
Spoon one quarter of the tomato sauce over the base of an ovenproof dish and arrange the pasta shells, open-side uppermost, on top. Pour the remaining sauce evenly over, then scatter with the mozzarella and the remaining Parmesan.
Bake in a preheated oven, 220°C (425°F), Gas Mark 7, for 20 minutes until golden brown.