Preheat the oven to 160°C (fan assisted)/180°C/gas 4.
Cook the pasta according to the packet's instructions, until just al dente.
Grate the courgette and slice the cherry tomatoes in half.
Mix the cooked pasta, grated courgette, cherry tomatoes, pesto, and spinach together in a large bowl until combined.
Pour the pasta mixture into a baking dish and sprinkle over the grated cheese. Finish with a crack of black pepper.
Bake in the preheated oven for 25 minutes, or until the cheese is melted and bubbling.
