We describe the GALFORM semi-analytic model for calculating the formation and evolution of galaxies in hierarchical clustering cosmologies. It improves upon, and extends, the earlier scheme developed by Cole et al. The model employs a new Monte Carlo algorithm to follow the merging evolution of dark matter haloes with arbitrary mass resolution. It incorporates realistic descriptions of the density profiles of dark matter haloes and the gas they contain; it follows the chemical evolution of gas and stars, and the associated production of dust; and it includes a detailed calculation of the sizes of discs and spheroids. Wherever possible, our prescriptions for modelling individual physical processes are based on results of numerical simulations. They require a number of adjustable parameters, which we fix by reference to a small subset of local galaxy data. This results in a fully specified model of galaxy formation which can be tested against other data. We apply our methods to the ΛCDM cosmology f12(M1,M2) dM1 [1/√2π] [(δc1 - δc2)/ (σ21 - σ22)3/2] x exp [-(δc1 - δc2)2/ 2(σ22)] [dσ21/dM1] d M1 (Ω0=0.3) (df12)/(dt1 t1t2) dM1 dt1 [1/√(2π)] [1 / σ21 - σ22)3/2] [dδc1/dt1] [dσ21/dM1] dM1 dt1 Λ0=0.7),-> and find good agreement with a wide range of properties of the local galaxy population: the B- and K-band luminosity functions, the distribution of colours for the population as a whole, the ratio of ellipticals to spirals, the distribution of disc sizes, and the current cold gas content of discs. In spite of the overall success of the model, some interesting discrepancies remain: the colour-magnitude relation for ellipticals in clusters is significantly flatter than observed at bright magnitudes (although the scatter is about right), and the model predicts galaxy circular velocities, at a given luminosity, that are about 30per cent larger than is observed. It is unclear whether these discrepancies represent fundamental shortcomings of the model, or whether they result from the various approximations and uncertainties inherent in the technique. Our more detailed methods do not change our earlier conclusion that just over half the stars in the Universe are expected to have formed since [dN/dM1] [df12/dt1] [M2/M1] dt1 (M1 < M2). z <~1.5.