The primary function of enamel is to protect the tooth from mechanical damage (such as chewing and grinding) and chemical erosion (from acidic foods and beverages). It also provides a barrier against bacteria and other harmful substances that could damage the inner structures of the tooth.