Cook olives, garlic, and red pepper flakes in oil in a 12-inch nonstick skillet over moderate heat, stirring, until garlic is golden, about 2 minutes. Stir in the tomatoes and salt and simmer, stirring occasionally and breaking up any large pieces of tomato, until sauce is slightly thickened, 10 to 15 minutes.
While the sauce is simmering, cook the spaghetti in a 6 to 8-quart pot of boiling salted water until al dente.
Drain spaghetti in a colander and add to sauce. Cook, tossing, over moderately low heat until pasta is coated, 30 seconds to 1 minute.