After a quench, observables in an integrable system may not relax to the standard thermal values, but can relax to the ones predicted by the generalized Gibbs ensemble (GGE) [M. Rigol et al., Phys. Rev. Lett. 98, 050405 (2007)]. The GGE has been shown to accurately describe observables in various one-dimensional integrable systems, but the origin of its success is not fully understood. Here we introduce a microcanonical version of the GGE and provide a justification of the GGE based on a generalized interpretation of the eigenstate thermalization hypothesis, which was previously introduced to explain thermalization of nonintegrable systems. We study relaxation after a quench of one-dimensional hard-core bosons in an optical lattice. Exact numerical calculations for up to 10 particles on 50 lattice sites (approximate to 10(10) eigenstates) validate our approach.