Heat the oven and prep the dish: Preheat your oven to 375°F (190°C).
Lightly butter or oil a 9x13-inch baking dish.
Cook the pasta: Boil in well-salted water until just shy of al dente (about 1–2 minutes less than the package says). Drain and set aside.
Build the sauce base: Warm olive oil in a large skillet over medium heat. Sauté onion with a pinch of salt until soft and translucent, 5–7 minutes.
Add garlic and cook 30 seconds until fragrant.
Add tomatoes and seasonings: Stir in crushed tomatoes, tomato paste, oregano, basil, red pepper flakes, salt, and pepper. Simmer 10–12 minutes to thicken slightly. Taste and adjust seasoning.
Wilt the spinach: Stir chopped spinach into the sauce until just wilted, 1–2 minutes.
Turn off the heat.
Mix the cheeses: In a bowl, combine ricotta with half of the Parmesan and a pinch of salt and pepper. If you like, add chopped basil or parsley.
Combine pasta and sauce: Toss the cooked pasta with the tomato-spinach sauce until evenly coated.
Layer it up: Add half the pasta mixture to the baking dish. Dollop half the ricotta mixture across the top.
Sprinkle with half the mozzarella. Repeat with the remaining pasta, ricotta, and mozzarella. Finish with the remaining Parmesan.
Bake: Cover loosely with foil and bake 15 minutes.
Remove foil and bake another 10–15 minutes, until the top is melted and golden-brown in spots.
Rest and serve: Let sit 10 minutes before scooping. Garnish with more herbs if you like. Serve warm.