Heat 2 tablespoons of olive oil in a large skillet or Dutch oven over medium heat; add the finely chopped yellow onion and cook, stirring occasionally, until softened and translucent, about 5–7 minutes.
Stir in the minced garlic and red pepper flakes (if using) and cook for 1 minute more until fragrant, taking care not to burn the garlic.
Pour in the crushed tomatoes; add the dried oregano, 1 teaspoon of salt, and the black pepper. Bring to a gentle simmer, then reduce heat to low, cover, and cook for 20–30 minutes, stirring occasionally.
While the sauce simmers, bring a large pot of generously salted water to a rolling boil. Add the spaghetti and cook for 8–10 minutes until al dente. Reserve 1 cup of the pasta cooking water, then drain the pasta.
Add the drained spaghetti and the chopped fresh basil leaves to the sauce. Toss everything together, adding a splash or two of the reserved pasta water if the sauce is too thick.
Serve immediately, topped with grated Parmesan cheese and extra fresh basil leaves if desired.