The deoxynucleotide triphosphate (dNTP) hydrolase SAMHD1 inhibits retroviruses in non-dividing myeloid cells. Although antiviral activity towards DNA viruses has also been demonstrated, the role of SAMHD1 during cytomegalovirus (CMV) infection remains unclear. To determine the impact of SAMHD1 on the replication of CMV, we used murine CMV (MCMV) to infect a previously established SAMHD1 knockout mouse model and found that SAMHD1 inhibits the replication of MCMV in vivo. By comparing the replication of MCMV in vitro in myeloid cells and fibroblasts from SAMHD1-knockout and control mice, we found that the viral kinase M97 counteracts SAMHD1 after infection by phosphorylating the regulatory residue threonine 603. The phosphorylation of SAMHD1 in infected cells correlated with a reduced level of dNTP hydrolase activity and the loss of viral restriction. Together, we demonstrate that SAMHD1 acts as a restriction factor in vivo and we identify the M97-mediated phosphorylation of SAMHD1 as a previously undescribed viral countermeasure.