In a large skillet or pot over medium heat, heat oil. Add garlic and cook until fragrant, 1 minute. Add anchovy fillets and cook until fragrant, another minute.
Add tomatoes, olives, capers, and red pepper flakes. Bring to a boil, then reduce heat and let simmer for 15 minutes, adding a splash of water if there is not enough liquid.
Meanwhile, bring a large pot of salted water to a boil. Add spaghetti and cook according to package directions, until al dente. Drain.
Toss spaghetti in sauce. Sprinkle with parsley and Parmesan and serve.