The structural, electronic and magnetic properties of bulk Gd and of the Gd(0001) surface have been investigated using ab initio calculations based on density-functional theory (DFT) and on DFT+U calculations. In agreement with earlier work we find that the neglect of the strong correlation of the 4f electrons leads to the wrong prediction of an antiferromagnetic ground state of hexagonal close-packed (hcp) Gd, as well as to substantial errors in the magnetic moments and exchange splitting. If the strong on-site Coulomb repulsion in the 4f band is described by a Hubbard-like term added to the DFT Hamiltonian, an improved description of the structural, electronic and magnetic properties of both bulk Gd and of the Gd(0001) surface is achieved. The enhancement of the exchange coupling and of the magnetic ordering temperature at the surface is investigated using a simple model. The adsorption of hydrogen on the Gd(0001) surface and its diffusion into deeper layers has been investigated. It is shown that H adsorption eliminates the electronic surface state which is partly responsible for the enhanced magnetism at the clean surface and leads to the formation of H-induced electronic states below the bottom of the valence band.