We calculate in three-flavor lattice QCD the short-distance hadronic matrix elements of all five ΔC ¼ 2 four-fermion operators that contribute to neutral D-meson mixing both in and beyond the Standard Model. We use the MILC Collaboration's N f ¼ 2 þ 1 lattice gauge-field configurations generated with asqtadimproved staggered sea quarks. We also employ the asqtad action for the valence light quarks and use the clover action with the Fermilab interpretation for the charm quark. We analyze a large set of ensembles with pions as light as M π ≈ 180 MeV and lattice spacings as fine as a ≈ 0.045 fm, thereby enabling good control over the extrapolation to the physical pion mass and continuum limit. We obtain for the matrix elements in theMS-NDR scheme using the choice of evanescent operators proposed by Beneke et al., evaluated at 3 GeV, hD 0 jO i jD 0 i ¼ f0.0805ð55Þð16Þ; −0.1561ð70Þð31Þ; 0.0464ð31Þð9Þ; 0.2747ð129Þð55Þ; 0.1035ð71Þð21Þg GeV 4 (i ¼ 1-5). The errors shown are from statistics and lattice systematics, and the omission of charmed sea quarks, respectively. To illustrate the utility of our matrix-element results, we place bounds on the scale of CP-violating new physics in D 0 mixing, finding lower limits of about 10-50 × 10 3 TeV for couplings of Oð1Þ. To enable our results to be employed in more sophisticated or model-specific phenomenological studies, we provide the correlations among our matrix-element results. For convenience, we also present numerical results in the other commonly used scheme of Buras, Misiak, and Urban.