We perform a joint likelihood analysis of the power spectra of the 2dF Galaxy Redshift Survey (2dFGRS) and the cosmic microwave background (CMB) anisotropies under the assumptions that the initial fluctuations were adiabatic, Gaussian and well described by power laws with scalar and tensor indices of ns and nt. On its own, the 2dFGRS sets tight limits on the parameter combination Ωmh, but relatively weak limits on the fraction of the cosmic matter density in baryons Ωb/Ωm. (Here h is Hubble's constant H0 in units of 100 km s-1 Mpc-1. The cosmic densities in baryons, cold dark matter and vacuum energy are denoted by Ωb, Ωc and ΩΛ, respectively. The total matter density is Ωm = Ωb + Ωc and the curvature is fixed by Ωk = 1 - Ωm - ΩΛ.) The CMB anisotropy data alone set poor constraints on the cosmological constant and Hubble constant because of a 'geometrical degeneracy' among parameters. Furthermore, if tensor modes are allowed, the CMB data allow a wide range of values for the physical densities in baryons and cold dark matter (ωb = Ωbh2 and ωc = Ωch2). Combining the CMB and 2dFGRS data sets helps to break both the geometrical and tensor mode degeneracies. The values of the parameters derived here are consistent with the predictions of the simplest models of inflation, with the baryon density derived from primordial nucleosynthesis and with direct measurements of the Hubble parameter. In particular, we find strong evidence for a positive cosmological constant with a ±2σ range of 0.65 < ΩΛ < 0.85, independently of constraints on ΩΛ derived from Type Ia supernovae.