We combine the Two Micron All Sky Survey (2MASS) Extended Source Catalogue and the 2dF Galaxy Redshift Survey to produce an infrared selected galaxy catalogue with 17 173 measured redshifts. We use this extensive data set to estimate the galaxy luminosity functions in the J- and KS-bands. The luminosity functions are fairly well fitted by Schechter functions with parameters M*J - 5log h = -22.36 ± 0.02, αJ = -0.93 ± 0.04, ΦJ* = 0.0104 ± 0.0016h3 Mpc-3 in the J-band and M*Ks - 5log h = -23.44 ± 0.03, αKs = -0.96 ± 0.05, ΦKs* = 0.0108 ± 0.0016h3 Mpc-3 in the Ks-band (2MASS Kron magnitudes). These parameters are derived assuming a cosmological model with Ω0 = 0.3 and Λ0 = 0.7. With data sets of this size, systematic rather than random errors are the dominant source of uncertainty in the determination of the luminosity function. We carry out a careful investigation of possible systematic effects in our data. The surface brightness distribution of the sample shows no evidence that significant numbers of low surface brightness or compact galaxies are missed by the survey. We estimate the present-day distributions of bJ - KS and J - KS colours as a function of the absolute magnitude and use models of the galaxy stellar populations, constrained by the observed optical and infrared colours, to infer the galaxy stellar mass function. Integrated over all galaxy masses, this yields a total mass fraction in stars (in units of the critical mass density) of Ωstarsh = (1.6 ± 0.24) × 10-3 for a Kennicutt initial mass function (IMF) and Ωstarsh = (2.9 ± 0.43) × 10-3 for a Salpeter IMF. These values are consistent with those inferred from observational estimates of the total star formation history of the Universe provided that dust extinction corrections are modest.