We derive constraints on cosmological parameters using the power spectrum of galaxy clustering measured from the final two-degree field galaxy redshift survey (2dFGRS) and a compilation of measurements of the temperature power spectrum and temperature-polarization cross-correlation of the cosmic microwave background radiation. We analyse a range of parameter sets and priors, allowing for massive neutrinos, curvature, tensors and general dark energy models. In all cases, the combination of datasets tightens the constraints, with the most dramatic improvements found for the density of dark matter and the energy-density of dark energy. If we assume a flat universe, we find a matter density parameter of $Omega_{rm m}=0.237 pm 0.020$, a baryon density parameter of $Omega_{rm b} = 0.041 pm 0.002$, a Hubble constant of $H_{0}=74pm2 {rm kms}^{-1}{rm Mpc}^{-1}$, a linear theory matter fluctuation amplitude of $sigma_{8}=0.77pm0.05$ and a scalar spectral index of $n_{rm s}=0.954 pm 0.023$ (all errors show the 68% interval). Our estimate of $n_{rm s}$ is only marginally consistent with the scale invariant value $n_{rm s}=1$; this spectrum is formally excluded at the 95% confidence level. However, the detection of a tilt in the spectrum is sensitive to the choice of parameter space. If we allow the equation of state of the dark energy to float, we find $w_{rm DE}= -0.85_{-0.17}^{+0.18}$, consistent with a cosmological constant. We also place new limits on the mass fraction of massive neutrinos: $f_{ u} < 0.105$ at the 95% level, corresponding to $sum m_{ u} < 1.2$ eV.