Bring a pot of water to a boil and cook the spaghetti according to the package instructions. Cook until al dente, 1–2 minutes less than the stated time.
Fry the chopped garlic in oil. When it begins to turn golden, add the anchovy fillets, capers, chili pepper, and olives. Heat for a couple of minutes.
Pour in the chopped tomatoes. When they are hot, add the cooked spaghetti and heat for 1–2 minutes. If the sauce is too thick, add some pasta cooking water. Season with salt and pepper and stir in the chopped parsley.
Sprinkle with grated Parmesan after serving the pasta onto plates.