Recently, Kostelecky [V. A. Kostelecky, Phys. Lett. B 701, 137 (2011)] proposed that the spontaneous Lorentz invariance violation (sLIV) is related to Finsler geometry. Finsler spacetime is intrinsically anisotropic and naturally induces Lorentz invariance violation (LIV). In this paper, the electromagnetic field is investigated in locally Minkowski spacetime. The Lagrangian is presented explicitly for the electromagnetic field. It is compatible with the one in the standard model extension (SME). We show the Lorentz-violating Maxwell equations as well as the electromagnetic wave equation. The formal plane wave solution is obtained for the electromagnetic wave. The speed of light may depend on the direction of light and the lightcone may be enlarged or narrowed. The LIV effects could be viewed as influence from an anisotropic media on the electromagnetic wave. In addition, birefringence of light will not emerge at the leading order in this model. A constraint on the spacetime anisotropy is obtained from observations on gamma-ray bursts (GRBs).