A cornerstone of Einstein's special relativity is Lorentz invariance-the postulate that all observers measure exactly the same speed of light in vacuum, independent of photon-energy. While special relativity assumes that there is no fundamental length-scale associated with such invariance, there is a fundamental scale (the Planck scale, l(Planck) approximately 1.62 x 10(-33) cm or E(Planck) = M(Planck)c(2) approximately 1.22 x 10(19) GeV), at which quantum effects are expected to strongly affect the nature of space-time. There is great interest in the (not yet validated) idea that Lorentz invariance might break near the Planck scale. A key test of such violation of Lorentz invariance is a possible variation of photon speed with energy. Even a tiny variation in photon speed, when accumulated over cosmological light-travel times, may be revealed by observing sharp features in gamma-ray burst (GRB) light-curves. Here we report the detection of emission up to approximately 31 GeV from the distant and short GRB 090510. We find no evidence for the violation of Lorentz invariance, and place a lower limit of 1.2E(Planck) on the scale of a linear energy dependence (or an inverse wavelength dependence), subject to reasonable assumptions about the emission (equivalently we have an upper limit of l(Planck)/1.2 on the length scale of the effect). Our results disfavour quantum-gravity theories in which the quantum nature of space-time on a very small scale linearly alters the speed of light.