Cook the spaghetti or linguine according to package instructions in a large pot of salted boiling water until al dente. Drain and set aside, reserving 1/2 cup of 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 but not browned.
Stir in the drained diced tomatoes, oregano, basil, salt, pepper, and red pepper flakes (if using). Cook for 5-7 minutes, allowing the sauce to thicken slightly.
Add the cooked pasta to the skillet, tossing to combine. If the sauce is too thick, add a little reserved pasta water until you reach your desired consistency.
Remove from heat and stir in the chopped fresh basil. Serve immediately, topped with grated Parmesan cheese.