In a food processor, combine basil leaves, grated Parmesan cheese, pine nuts (or walnuts), and peeled garlic cloves. Pulse until the ingredients are finely chopped.
With the food processor running, slowly drizzle in the extra-virgin olive oil until the mixture becomes a smooth and creamy pesto sauce. Stop and scrape down the sides as needed.
Season the pesto with salt and pepper to taste. Pulse a few more times to incorporate the seasoning.
Bring a large pot of salted water to a boil. Cook the spaghetti (or your chosen pasta) according to the package instructions until al dente. Reserve about 1 cup of pasta cooking water before draining.
Add 1/3 cup pesto from food processor to cooked pasta and stir to well combine. Add 2 tablespoons of pasta water to spaghetti and stir. Add more to make it a more smooth and creamy consistency.
Serve immediately and enjoy!