A magnetic field sensor includes at least one sensing circuit including giant magnetoresistive (GMR) elements. At least one of the GMR elements is at least partially housed in a flux-reducing or flux-concentrating first shielding material that reduces or amplifies, respectively, the magnetic field impinging on the element(s), while at least one other GMR element is housed in a second shielding material having an effect opposite that of the first shielding material, or is not housed in any shielding material. A measurement circuit is configured to measure voltage between different points of the GMR sensing circuit, allowing derivation of electric impedance between the different measurement points. An evaluation circuit evaluates the impedances and the relationships therebetween to derive a signal that indicates the strength of an applied magnetic field.