An enzyme that creates a phosphodiester bond between the 3′ end of one DNA segment and the 5′ end of another, while they are base-paired to a template strand. The enzyme seals (joins) the ends of single-stranded DNA in a duplex DNA chain. DNA ligase constitutes a part of the DNA repair mechanism available to the cell.