The structural, optical and electrical properties of un-doped and (Al,Er) co-doped zinc oxide (ZnO) powders synthesized by hydrothermal method were investigated. The obtained samples were characterized by X-ray diffraction (XRD), transmission electron microscopy (TEM), energy-dispersive spectroscopy and magnetic measurements. XRD results reveal that the incorporation of Al and Er in ZnO matrix leads to the formation of a nanostructured hexagonal (würtzite) ZnO structure and α-Al2O3 secondary phase. High-resolution transmission electron microscopy image also shows the hexagonal shape of the ZnO nanoparticles. The magnetic behavior of the nanoparticles changes with concentration of dopant elements due to the competition between oxygen vacancies, secondary phase effect and exchange interaction between dopant elements. © 2017 The Royal Society of Chemistry.