We derive the coarse-grained interactions between DNA nucleotides from ab initio total-energy calculations based on density functional theory (DFT). The interactions take into account base and sequence specificity, and are decomposed into physically distinct contributions that includehydrogen bonding, stacking interactions, backbone, and backbone-base interactions. The interaction energies of each contribution are calculated from DFT for a wide range of configurations and are fitted by simple analytical expressions for use in the coarse-grained model, which reduces each nucleotide into two sites. This model is not derived from experimental data, yet it successfully reproduces the stable B-DNA structure and gives good predictions for the persistence length. It may be used to realistically probe dynamics of DNA strands in various environments at the μs time scale and the μm length scale.