Fill a large pot with salted water and bring to a boil. Add 8 oz (225g) spaghetti and cook until al dente, about 8-9 minutes. Reserve 1 cup (240ml) of pasta water before draining.
While pasta cooks, heat 2 tablespoons olive oil in a large skillet over medium heat. Add minced garlic and cook, stirring often, until fragrant and just starting to turn golden, about 2-3 minutes. Avoid burning.
Turn off the heat and stir in the zest and juice from one lemon.
In a bowl, stir together 1 cup (250g) ricotta and about ½ cup (120ml) reserved pasta water until smooth and creamy.
Add the drained pasta to the skillet with the garlic-lemon oil. Pour in the ricotta mixture and toss gently over low heat. Add more pasta water as needed for a silky texture. Season with salt and black pepper to taste.
Turn off the heat and stir in chopped fresh basil or parsley and ¼ cup (25g) grated Parmesan cheese. Add red pepper flakes if desired.
Serve immediately while warm and creamy, optionally drizzling extra olive oil and sprinkling more Parmesan.
