Combine the basil in with the pine nuts, pulse a few times in a food processor. (If you are using walnuts instead of pine nuts and they are not already chopped, pulse them a few times first, before adding the spinach or basil.) Add the garlic, pulse a few times more.
Slowly add the olive oil in a constant stream while the food processor is on. Stop to scrape down the sides of the food processor with a rubber spatula. Add the grated cheese and pulse again until blended. Add a pinch of salt and freshly ground black pepper to taste.