1. In a 5- to 6-quart pan over high heat, bring about 3 quarts water to a boil. Add spaghetti and cook, stirring occasionally, until tender to bite, 7 to 12 minutes. Drain, reserving 1 1/2 cups pasta-cooking water. Return spaghetti to pan.
2. Meanwhile, heat oil in a 10- to 12-inch frying pan over medium heat. Add garlic; stir until fragrant but not brown, 1 to 2 minutes. Add chard; stir 3 to 4 minutes. Add 1 cup of reserved water; cook until chard stems are tenderto bite, 6 to 8 minutes.
3. Mix chard mixture into hot spaghetti with ricotta, pistachios, pecorino, lemon peel, lemon juice, remaining 1/2 cup reserved pasta-cooking water, and salt and pepper to taste.