Structural and electronic properties of the cubic perovskite ZnTiO3 and spinel Zn2TiO4 are theoretically studied by the modified Becke–Johnson (mBJ) potential within the framework of density functional theory (DFT). The calculated lattice constants are found to be consistent with the experimental results. The electronic band structures of both the materials reveal that ZnTiO3 is an indirect band gap while Zn2TiO4 is a direct band gap semiconductor. The calculated fundamental band gaps of these compounds are 2.7eV and 3.18eV, which are consistent with the experimental band gaps of 2.9eV and 3.1eV, respectively. Zn2TiO4 is a wide and direct band gap compound and hence is an attractive material for optoelectronic applications, especially in near ultraviolet (UV) optoelectronics. Keeping in view the importance of Zn2TiO4 in low frequency UV devices its optical properties like dielectric functions, refractive index, reflectivity and energy loss function are also evaluated and discussed in detail.