Both room temperature ferromagnetism and band gap of the ZnMgO films can be simultaneously tuned by oxygen vacancies. Singly occupied oxygen vacancies overlap each other resulting in a long-range ferromagnetic ordering. Band gap narrowing is due to the formation of impurity band in the vicinity of valence band from oxygen vacancies.