It's the acids in the spinach, primarily oxalic acid, the same acid that is in rhubarb leaves. It is said that the gritty or squeaky feeling on the teeth is the combination of the oxalic acid with proteins like milk on the surface of the teeth.
(don't eat 10 pounds of spinach at a sitting, you could give yourself oxalic acid poisoning and get kidney failure. People with kidney disease should be cautious of spinach Rhubarb leaves should not be eaten at all.)
You can get similar tooth effects from Coke and from tea
Coke has phosphoric acid in it
Tea (and oak tree acorns) have tannic acid