In this Thesis, different approximations to the synthesis of composites of magnetic nanoparticles in silica aerogel or xerogel matrices have been studied. In particular, we have obtained materials with a range of different properties regarding its magnetism (hard or soft magnetic materials), optical properties (transparent, opaque, anisotropic) or density and we have studied its potential magneto-optical applications. The xerogel matrices have also been used to stabilize by confinement a rare iron (III) oxide polymorph, the ε-Fe2O3, which has not been much studied so far. The magnetic properties of the polymorph have been studied in detail and it has been established that it has a Curie temperature of 510 K. At room temperature, it presents a collinear ferromagnetic order with a moderate magnetization (20 emu/g at saturation) and a large magnetic anisotropy which result in a huge coercivity of about 20 kOe. Between 150 and 80 K, ε-Fe2O3 presents a second order magnetic and structural transition to a “square-wave” incommensurate magnetic order. Concomitantly with this transition it has been shown that the material presents a magnetoelectric coupling.