Caries (tooth decay) causes pain when the lesion extends through the enamel into dentin (resulting in sufficient demineralization of tooth structure to cause a cavitation in the outer surface of the tooth enamel).