A new general-relativistic theory of cosmology, die dynamical variables of which are those of Hubble's, namely distances and redshifts, is presented. The theory describes the universe as having a three-phase evolution with a decelerating expansion followed by a constant and an accelerating expansion, and it predicts that the universe is now in the latter phase. The theory is actually a generalization of Hubble's law taking gravity into account by means of Einstein's theory of general relativity. The equations obtained for the universe expansion are elegant and very simple. It is shown, assuming Omega(0) = 0.24, that the time at which the universe goes over from a decelerating to an accelerating expansion, i.e., the constant expansion phase, occurs at 0.03 tau from the big bang, where tau is the Hubble time in vacuum. Also, at that time the cosmic radiation temperature was 11 K. Recent observations of distant supernovae imply, in defiance of expectations, that the universe's growth is accelerating, contrary to what has always been assumed, that the expansion is slowing down due to gravity. Our theory confirms these recent experimental results by showing that the universe now is definitely in a stage of accelerating expansion.