Tailoring the band gap of metal oxides is an attractive property for various device applications. Zinc–magnesium-oxide (Zn1−xMgxO) is a sustainable material that allows control of the energy band gap through the Mg content. To reduce the deposition costs of Zn1−xMgxO, solution-based techniques can be employed. This study investigates spray-pyrolysis as a versatile, environment-friendly, solution-based deposition method to fabricate Zn1−xMgxO films with morphology and properties that strongly depend on the composition of the water-based precursor solution. Films that are either compact or covered with nanorods are obtained, with tunable amounts of incorporated Mg and corresponding band gap values. In order to show the applicability of these films, Zn1−xMgxO was sprayed onto transparent conducting oxide substrates that are commonly used in various devices, such as solar cells with superstrate architecture.