Bring a large pot of salted water to a boil. Add the spaghetti and cook according to package instructions until al dente. Reserve 1 cup of pasta water, then drain the pasta in a colander.
In a large skillet, heat the olive oil over medium heat. Add the minced garlic and sauté for about 1 minute, or until fragrant but not browned.
Reduce the heat to low, then add the ricotta cheese, lemon juice, and lemon zest to the skillet. Stir until combined, creating a creamy sauce.
Gradually add the reserved pasta water to the ricotta mixture, stirring until the sauce reaches your desired consistency.
Add the drained spaghetti to the skillet, tossing to coat the pasta evenly with the lemon ricotta sauce.
Mix in the grated Parmesan cheese and season with salt and freshly ground black pepper to taste.
Serve the pasta in individual bowls, garnished with fresh basil or parsley, and sprinkle with extra lemon zest if desired.