The electronic and magnetic properties of gadolinium are studied by means of the full-potential linear augmented plane-wave method including the Hubbard interaction for describing a 4f electron-electron interaction in the mean-field approximation. The manner in which the 4f localized orbitals are approximated seems to be of great importance in elucidating the mechanisms responsible for the strong magnetic moment of gadolinium and its ordered magnetic structure as well as the relative energy positions of the occupied and empty 4f states. Through various calculations, including the spin-orbit coupling in a second-variation scheme, within the local-spin-density approximation (LSDA), the generalized-gradient approximation (GGA), the LDA+U, and the GGA+U, it is clearly shown that the LDA+U or the GGA+U are the most adequate methods for describing the electronic and magnetic structures as well as the x-ray absorption (XAS) and x-ray magnetic circular dichroism (XMCD) of the the strongly correlated 4f electrons of gadolinium. In particular, the calculated L-2,L-3 and M-4,M-5 XAS and XMCD spectra are found in good agreement with the experimental ones except that the shoulder above the principal peak of the M-4,M-5 spectra is not present in the calculation. The spin magnetic moments of the 5d states obtained from the XMCD spectra using the XMCD sum rules compare favorably with the self-consistent band-structure results only when the dipole magnetic term is included in the calculation.