We provide a systematic quantitative description of spin polarization in armchair and zigzag graphene nanoribbons (GNRs) in a perpendicular magnetic field. We first address spinless electrons within the Hartree approximation, studying the evolution of the magnetoband structure and formation of the compressible strips. We discuss the potential profile and the density distribution near the edges and the difference and similarities between armchair and zigzag edges. Accounting for the Zeeman interaction and describing the spin effects via the Hubbard term, we study the spin-resolved subband structure and relate the spin polarization of the system at hand to the formation of the compressible strips for the case of spinless electrons. At high magnetic field the calculated effective g factor varies around a value of g * ≈ 2.25 for armchair GNRs and g * ≈ 3 for zigzag GNRs. An important finding is that in zigzag GNRs the zero-energy mode remains pinned to the Fermi energy and becomes fully spin polarized for all magnetic fields, which, in turn, leads to a strong spin polarization of the electron density near the zigzag edge. Because of this the effective g factor in zigzag GNRs is strongly enhanced at low fields reaching values up to g * ≈ 30. This is in contrast to armchair GNRs, where the effective g factor at low field is close to its bare value, g = 2.