As in Wikipedia,
A neodymium magnet (also known as NdFeB, NIB or Neo magnet) is the most widely used type of rare-earth magnet. It is a permanent magnet made from an alloy of neodymium, iron, and boron to form the Nd 2Fe 14B tetragonal crystalline structure.
The strength of neodymium magnets is due to several factors. The most important is that the tetragonal Nd2Fe14B crystal structure has exceptionally high uniaxial magnetocrystalline anisotropy (HA ≈ 7 T – magnetic field strength H in units of A/m versus magnetic moment in A·m2). This means a crystal of the material preferentially magnetizes along a specific crystal axis, but is very difficult to magnetize in other directions. Like other magnets, the neodymium magnet alloy is composed of microcrystalline grains which are aligned in a powerful magnetic field during manufacture so their magnetic axes all point in the same direction. The resistance of the crystal lattice to turning its direction of magnetization gives the compound a very high coercivity, or resistance to being demagnetized.