Bring a large pan of well salted water to the boil. Add the spaghetti and cook for 9-10 minutes for al dente, adding the broccoli for the final 2 minutes of cooking time.
Whilst the pasta is cooking, pour the olive oil into a large frying pan and place over a low/medium heat. Add the pine nuts and cook gently for 3-4 minutes, until lightly golden. Add the garlic and anchovy fillets to the pan and cook for 1-2 minutes, stirring from time to time, until the anchovies have melted down and the garlic is fragrant.
Once the pasta and broccoli are cooked al dente, drain, reserving a few tablespoons of the cooking water. Tip the pasta and broccoli into the frying pan, add the chilli, lemon zest and juice, parsley and reserved cooking water and toss until everything is well combined.
Serve immediately with a sprinkle of the grated pecorino or parmesan.