In pot of boiling, salted water, cook spaghetti halfway, about 6 minutes. Drain pasta, reserving 3 cups pasta cooking water. Return pasta and reserved water to pot. Add pesto and simmer over medium heat until water is absorbed and pasta is completely cooked through (but still al dente), about 15 minutes. Serve with cheese.