Heat a dry skillet over medium-high heat. When the pan is hot, add the walnuts in a single layer and stir or shake frequently until lightly browned, about 2 minutes.
Combine the walnuts and garlic in a food processor and pulse a few times to combine. Add the basil and spinach and pulse a few times to combine.
Add the lemon juice.
While mixing on low speed, add the olive oil in a slow stream until all the ingredients are fully blended.
Add the salt and pepper and pulse a few more times to combine.
Store in the refrigerator for up to 2 to 3 days, or freeze in ice cube trays.