Streptococcus pneumoniae is a Gram‐positive bacterium that is a major agent of community‐acquired bacterial pneumonia, meningitis and sepsis. Although the mismatch repair function of S. pneumoniae has been assigned to the hexA‐hexB gene products, an enzyme capable of the direct elimination of noncanonical nucleotides from the cytoplasm has not been described for this bacterium. Our results show that Spr1057, a protein with previously unknown function, is involved in the inactivation of mutagenic pyrimidine nucleotides and was accordingly designated PynA (pyrimidine nucleotidase A). Biochemical assays confirmed the phosphatase activity of the recombinant enzyme and revealed its metal ion dependence for optimal enzyme activity. We demonstrated that PynA forms a homodimer with higher in vitro activity towards noncanonical 5‐fluoro‐2′‐deoxyuridine monophosphate than towards canonical thymidine monophosphate. Furthermore, we showed via in vivo assays that PynA protects cells against noncanonical pyrimidine derivatives such as 5‐fluoro‐2′‐deoxyuridine and prevents the incorporation of the potentially mutagenic 5‐bromo‐2′‐deoxyuridine (5‐BrdU) into DNA. Fluctuation analysis performed under S. pneumoniae exposure to 5‐BrdU revealed that the pynA null strain accumulates random mutations with high frequency, resulting in a 30‐fold increase in the mutation rate. The data support a model in which PynA, a protein conserved in other Gram‐positive bacteria, functions as a house‐cleaning enzyme by selectively eliminating noncanonical nucleotides and maintaining the purity of dNTP pools, similar to the YjjG protein described for Escherichia coli.