A noncommutative polynomial is stable if it is nonsingular on all tuples of matrices whose imaginary parts are positive definite. In this paper a characterization of stable polynomials is given in terms of purely stable linear matrix pencils, i.e., pencils of the form H vertical bar iP(0) vertical bar P(1)x(1) vertical bar ... vertical bar P(d)x(d), where H is hermitian and P-j are positive semidefinite matrices. Namely, a noncommutative polynomial is stable if and only if it admits a determinantal representation with a purely stable pencil. More generally, structure certificates for noncommutative stability are given for linear matrix pencils and noncommutative rational functions.