Al-doped Zn0.95Mg0.05O films were deposited on glass and silicon substrates by a sol–gel spin coating and the coated samples were dried at 350 to 450 °C and annealed at 550, 650, and 750 °C. The effects of Al content and annealing temperature on the structural and optical properties of Al-doped Zn0.95Mg0.05O thin films were studied. Al-doped Zn0.95Mg0.05O alloy films have a preferred orientation in the (002) direction. By increasing Al content, crystallinity as well as transmittance was decreased. An X-ray photoelectron spectroscopy (XPS) analysis of Al-doped Zn0.95Mg0.05O thin films was performed to determine the chemical state on the surface of the thin films. The resistivities of the thin films were found to increase with increasing Al content and decrease with increasing annealing temperature. For an Al (0.5 wt %)-doped Zn0.95Mg0.05O thin film with a low resistivity of 3.15×10-2 Ω cm dried at 450 °C and annealed at 750 °C, optical band gap increased from 3.08 to 3.32 eV.