Heat a medium-sized pot on medium heat. Add onion and mushrooms and sauté for 5-7 minutes, until tender and the liquid from the mushrooms has been largely cooked off. Add garlic and season with salt, pepper and red pepper flakes (if using) and sauté for another 30 seconds.
Increase heat to high, then add tomatoes and vegetable broth. Bring to a boil. Add spaghetti noodles and stir until they wilt and fit in the pot. Cover the pot, reduce heat to medium-low and cook for 5 minutes. (Your liquid should be at a low boil this whole time.) Remove lid and add fresh spinach, a couple of handfuls at a time, stirring to get the spinach mixed in and wilted.
Remove from heat and let the spaghetti sit, covered, for a few minutes. Stir in cheese, taste and adjust seasonings. Serve with fresh basil or parsley and extra cheese, if desired.