Heat the olive oil in a large skillet over medium heat. Add the anchovy paste and cook, stirring, until dissolved. Add the shallot and garlic, and cook, stirring, for 1 minute.
Place the spaghetti in the skillet, add the tomatoes, olives, half the basil, the salt, red pepper flakes, pepper, and water. Turn heat to high and bring to a boil. Let boil, stirring with tongs or forks, until the water has mostly evaporated and the pasta is cooked, about 10 minutes.
Grate half the cheese over the pasta, stir, and then grate the rest of cheese over and sprinkle on the remaining basil leaves.