When a tooth is exposed to acid frequently — for example, if you often have foods or drinks containing sugar and starches — the repeated cycles of acid attacks cause the enamel to continue to lose minerals. A white spot may appear where minerals have been lost. This is a sign of early decay. Tooth decay can be stopped or reversed at this point. Enamel can repair itself by using minerals from saliva and fluoride from toothpaste or other sources. But if the tooth decay process continues, more minerals are lost. Over time, the enamel is weakened and destroyed, forming a cavity. A cavity is permanent damage that a dentist has to repair with a filling.
— Source: National Institute of Dental and Craniofacial Research