Bring a large pot of salted water to a boil. Once boiling, add the spaghetti and cook according to package instructions until al dente. Reserve ½ cup of pasta water, then drain the spaghetti in a colander.
While the spaghetti is cooking, heat the olive oil in a large skillet over medium heat. Add diced onion and sauté until translucent, about 3-4 minutes.
Stir in the minced garlic and cook for an additional 1 minute until fragrant.
Add the crushed tomatoes, dried basil, and dried oregano to the skillet. Season with salt and pepper to taste. Let the sauce simmer for about 10 minutes, stirring occasionally.
Add the fresh spinach to the sauce and cook for an additional 2-3 minutes, until wilted.
Toss the drained spaghetti into the skillet with the tomato sauce and spinach. If the sauce is too thick, add a little of the reserved pasta water to reach the desired consistency.
Serve hot, garnished with grated Parmesan cheese if desired.