
Step 1 · Soften the Vegetables
Heat the olive oil in a large pot or deep skillet over medium heat. Add the onion and carrots with a pinch of salt and cook, stirring, until soft, 6-8 minutes.
Step 2 · Brown the Mushrooms
Add the mushrooms and cook, stirring occasionally, until their liquid has evaporated and they are deeply browned, 8-10 minutes. Stir in the garlic and tomato paste and cook 1-2 minutes more.
Step 3 · Deglaze
Pour in the red wine, if using, scraping up any browned bits, and simmer until mostly evaporated, 2-3 minutes.
Step 4 · Simmer the Sauce
Add the crushed tomatoes and thyme sprigs. Bring to a simmer, then reduce the heat to low and cook, stirring now and then, for 20-25 minutes, until thick and rich. Remove the thyme stems and season with salt and pepper.
Step 5 · Cook the Pasta
Meanwhile, cook the spaghetti in well-salted boiling water until al dente. Reserve 1/2 cup of pasta water, then drain.
Step 6 · Combine and Serve
Toss the pasta with the sauce, loosening with a splash of pasta water as needed. Serve topped with torn basil and grated Parmesan, if using.