Heat the oven to 375°F. Cook mushrooms and onion in oil in a wide saucepan for 10 to 12 minutes until their water evaporates. Stir in garlic for 30 seconds.
Add crushed tomatoes, tomato sauce, basil, sauce salt and pepper and simmer for 10 minutes. Meanwhile, boil spaghetti in water with the tablespoon salt until 3 minutes short of the package time and drain.
Toss spaghetti thoroughly with the mushroom sauce, using tongs to coat the long strands. Transfer to a deep 9-by-13-inch baking dish.
Scatter mozzarella and Parmesan evenly over the pasta. Cover with foil and bake for 20 minutes.
Uncover for 8 to 10 minutes until the center reaches 165°F and the top has lightly browned patches. Rest for 10 minutes and lift servings with tongs and a wide spoon.