This paper studies the extreme gaps between eigenvalues of random matrices. We give the joint limiting law of the smallest gaps for Haar-distributed unitary matrices and matrices from the Gaussian unitary ensemble. In particular, the kth smallest gap, normalized by a factor n.4/3, has a limiting density proportional to x3k.1e.x3. Concerning the largest gaps, normalized by n/.logn, they converge in Lp to a constant for all p>0. These results are compared with the extreme gaps between zeros of the Riemann zeta function.