Numerical simulations are a versatile tool providing insight into the complicated process of structure formation in cosmology. This process is mainly governed by gravity, which is the dominant force on large scales. To date, a century after the formulation of general relativity, numerical codes for structure formation still employ Newton's law of gravitation. This approximation relies on the two assumptions that gravitational fields are weak and that they are only sourced by non-relativistic matter. While the former appears well justified on cosmological scales, the latter imposes restrictions on the nature of the "dark" components of the Universe (dark matter and dark energy) which are, however, poorly understood. Here we present the first simulations of cosmic structure formation using equations consistently derived from general relativity. We study in detail the small relativistic effects for a standard ΛCDM cosmology which cannot be obtained within a purely Newtonian framework. Our particle-mesh N-body code computes all six degrees of freedom of the metric and consistently solves the geodesic equation for particles, taking into account the relativistic potentials and the frame-dragging force. This conceptually clean approach is very general and can be applied to various settings where the Newtonian approximation fails or becomes inaccurate, ranging from simulations of models with dynamical dark energy or warm/hot dark matter to core collapse supernova explosions.