Bring a large pot of salted water to a boil, then add the pasta shells and cook until al dente, about 8-10 minutes. Drain and rinse with cold water to stop the cooking process.
While the pasta cooks, heat olive oil in a skillet over medium heat. Add minced garlic and sauté until fragrant, about 30 seconds, then add the chopped spinach. Cook until wilted and bright green, about 2-3 minutes, squeezing out excess moisture with a spatula or paper towel.
In a mixing bowl, combine the drained ricotta cheese, sautéed spinach, a pinch of nutmeg, salt, and pepper. Mix until smooth and well incorporated, adjusting seasoning to taste.
Use a spoon or piping bag to carefully fill each cooked shell with the ricotta-spinach mixture, making sure not to tear the shells and to fill them generously.
Spread a thin layer of marinara sauce over the bottom of a baking dish. Arrange the stuffed shells seam-side down in a single layer over the sauce.
Spoon the remaining marinara sauce over the shells and sprinkle evenly with shredded mozzarella cheese.
Cover the baking dish with foil and bake in a preheated oven at 180°C (350°F) for 25 minutes, until the sauce is bubbling.
Remove the foil and bake for an additional 10 minutes, or until the cheese is golden and bubbly on top.
Let the baked shells rest for 5 minutes outside the oven, then garnish with fresh basil if desired, and serve hot with extra sauce on the side.