Warm the cream very slowly and grate the cheese into it. As soon as it has melted, add the mushrooms cut into quarters and the ham cut into strips. Simmer for a few minutes on a low flame and season with garlic, salt and pepper.
In the meantime, bring the water to the boil and cook the spaghetti al dente. Cover with the sauce and serve.