Boil the pasta water: Bring a large pot of well-salted water to a rolling boil.
It should taste like the sea. This is your pasta seasoning.
Cook the spaghetti: Add the spaghetti and cook until just shy of al dente according to package directions. Reserve 1–1.5 cups pasta water before draining.
Heat the pan: While the pasta cooks, set a large skillet over medium-high heat. Add 2 tablespoons olive oil and let it shimmer.
Sauté the mushrooms: Add the mushrooms in an even layer.
Don’t crowd the pan. Let them sear undisturbed for 2–3 minutes, then stir. Cook 6–8 minutes total, until browned and their moisture cooks off.
Season with salt and pepper.
Add aromatics: Push mushrooms to one side. Add another tablespoon of olive oil, the shallot, and a pinch of red pepper flakes. Cook 1–2 minutes until fragrant.
Garlic time: Stir in the garlic and cook 30–60 seconds, just until fragrant.
Don’t let it brown.
Wilt the spinach: Add the spinach in batches with a splash of pasta water. Toss until just wilted and vibrant green, about 1–2 minutes.
Build the sauce: Add 1/2 cup reserved pasta water and the lemon zest. Simmer 30 seconds, then reduce heat to medium-low.
The liquid should look slightly silky.
Toss with pasta: Add the drained spaghetti to the skillet. Toss, adding more pasta water as needed to create a glossy, lightly saucy coating.
Finish: Off the heat, drizzle in another tablespoon of olive oil, squeeze in lemon juice to taste, and fold in the grated Parmesan. Season with salt and plenty of black pepper.
Toss in chopped parsley or basil if using.
Serve: Plate with extra cheese, a pinch of chili flakes, and a swirl of good olive oil. Eat hot.