Heat oil in a large pot over medium heat. Once hot, add the onion and sauté for 5 minutes.
Melt the butter into the pot. Add the mushrooms and cook, stirring often for 8–10 minutes until they begin to deepen in color and develop a golden-brown crust around the edges. Season with salt and pepper.
Stir the minced garlic and crushed red pepper in the mushrooms. Cook for 1 minute.
Simmer the sauce:
Pour in the water, wine, or stock and lift up anything stuck to the bottom of the pot. Pour in the tomatoes. Season to taste with salt, pepper, and a generous pinch of sugar if you like. Bring to a boil and then reduce heat, cover, and simmer for 45 minutes.
Cook the pasta:
Bring a large pot of water to a boil as the sauce cooks. Add salt and spaghetti. Cook until al dente. Scoop out ½ cup of the water and set aside. Drain the pasta.
Finish the sauce:
Stir the ricotta and spinach into the tomato sauce. As soon as the spinach begins to wilt, add the pasta and toss to coat. Add the pasta water as needed to loosen up the sauce so that it coats the pasta evenly. Taste and season once more.
To serve:
Divide the cooked pasta between shallow bowls. Garnish with parmesan cheese, fresh basil, and black pepper. Enjoy!