This paper deals with the calculation of the shielding tensor of nuclear magnetic resonance (NMR) spectroscopy based on a scalar relativistic two-component Pauli-type Hamiltonian. A complete formulation of the method within the framework of the "gauge including atomic orbitals" (GIAO) is given. Further, an implementation, based on density functional theory (DFT) is presented. The new method is applied to the 17O shielding in transition metal oxo complexes [MO4]n- (M = Cr, Mo, W; Mn, Tc, Rh; Ru, Os) and to the metal chemical shift in transition metal carbonyls M(CO)6 (M = Cr, Mo, W). This represents the first calculation of heavy element shifts that is based on a relativistic first principle quantum mechanical method. The inclusion of relativity is crucial for a proper description of ligand and metal shieldings in 5d complexes but it is also important in 4d complexes. Limitations of the method, among them the neglect of the spin-orbit coupling, are discussed in detail.