We present results for the equation of state in (2+1)-flavor QCD using the highly improved staggered quark action and lattices with temporal extent Nτ = 6, 8, 10, and 12. We show that these data can be reliably extrapolated to the continuum limit and obtain a number of thermodynamic quantities and the speed of sound in the temperature range (130-400) MeV. We compare our results with previous calculations, and provide an analytic parameterization of the pressure, from which other thermodynamic quantities can be calculated, for use in phenomenology. We show that the energy density in the crossover region, 145 MeV ≤ T ≤ 163 MeV, defined by the chiral transition, is c = (0.18 − 0.5) GeV/fm 3 , i.e., (1.2 − 3.1) nuclear . At high temperatures, we compare our results with resummed and dimensionally reduced perturbation theory calculations. As a byproduct of our analyses, we obtain the values of the scale parameters r0 from the static quark potential and w0 from the gradient flow.