Cook the Pasta: Begin by boiling a large pot of salted water. Add the spaghetti or linguine and cook according to package instructions until al dente. Reserve 1 cup of pasta water, then drain and set aside.
Make the Sauce: In a large skillet over medium heat, add the olive oil. Once hot, add the chopped onion and sauté for 3-4 minutes until softened and translucent.
Add Garlic and Tomatoes: Stir in the minced garlic and red pepper flakes, cooking for an additional minute until fragrant. Then, add the diced tomatoes. Cook for about 8-10 minutes, stirring occasionally, until the tomatoes break down and form a sauce.
Combine Pasta and Sauce: Add the cooked pasta to the skillet with the tomato sauce. Toss to combine, allowing the pasta to soak up some of the sauce. If the sauce is too thick, add reserved pasta water a little at a time until the desired consistency is reached.
Finish with Basil: Remove from heat and stir in the chopped basil, seasoning with salt and black pepper to taste. Toss everything once more to ensure the pasta is fully coated.
Serve: Plate the pasta hot, garnishing with additional fresh basil and grated Parmesan cheese, if desired.