  It is well-known that orthogonal polynomials on the real line satisfy a
three-term recurrence relation and conversely every system of polynomials
satisfying a three-term recurrence relation is orthogonal with respect to some
positive Borel measure on the real line. In this paper we extend this result
and show that every system of polynomials satisfying some $(2N+1)$-term
recurrence relation can be expressed in terms of orthonormal matrix polynomials
for which the coefficients are $N\times N$ matrices. We apply this result to
polynomials orthogonal with respect to a discrete Sobolev inner product and
other inner products in the linear space of polynomials. As an application we
give a short proof of Krein's characterization of orthogonal polynomials with a
spectrum having a finite number of accumulation points.
