Finely chop walnuts, basil and garlic and mix with 50 g grated pecorino cheese. Carefully mix in enough oil to create a creamy mixture. Season to taste with pepper and salt.
Cook the spaghetti in salted water until cooked. Stir ½ cup of the cooking liquid into the sauce.
Drain the spaghetti and mix with the sauce. Serve immediately, pour the rest of the pecorino on top.