Cook the spaghetti or linguine according to package instructions until al dente. Drain and set aside, reserving 1/2 cup of the pasta water.
In a large skillet, heat the olive oil over medium heat. Add the minced garlic and sauté for about 1 minute until fragrant.
Add the shrimp to the skillet and cook for 2-3 minutes, or until they turn pink and opaque.
Stir in the diced tomatoes (with their juice), Italian seasoning, salt, pepper, and red pepper flakes if using. Bring to a simmer and cook for 5 minutes.
Add the fresh spinach to the skillet and cook until wilted, about 2 minutes.
Toss the cooked pasta into the skillet with the shrimp and tomato mixture. If the pasta seems dry, add a little reserved pasta water to reach your desired consistency.
Serve hot, topped with grated Parmesan cheese and fresh basil leaves if desired.