Bring a large pot of water to a boil, then add salt and the spaghetti and cook until al dente.
In the meantime, prepare the pecorino cream. Grate the pecorino Romano into a large pan, keeping a little aside to put on the pasta before serving.
Add some pasta cooking water to the pan with the pecorino Romano. This will prevent the formation of lumps, as the pasta starch in the water will serve to hinder the tendency of milk proteins to coagulate in contact with the heat.
When you drain the pasta, keep part of the cooking water in case you need it later to thin the pecorino Romano cream if it is too thick.
Add the spaghetti to the pan with the pecorino Romano cream and mix quickly.
Serve with plenty of freshly ground black pepper and a little grated pecorino.
Notes
The tradition of cacio e pepe pasta involves the use of spaghetti, but it is not strange to see the use of tonnarelli, rigatoni, or egg pasta. However, the egg pasta and tonnarelli are too porous and thus absorb the seasoning too much, so if you want to make excellent cacio e pepe pasta, use spaghetti.