Let RR be an expanding matrix with integer entries, and let B,LB,L be finite integer digit sets so that (R,B,L)(R,B,L) form a Hadamard triple on Rd{\mathbb {R}}^d in the sense that the matrix 1|detR|[e2πi⟨R−1b,ℓ⟩]ℓ∈L,b∈B\begin{equation*} \frac {1}{\sqrt {|\det R|}}\left [e^{2\pi i \langle R^{-1}b,\ell \rangle }\right ]_{\ell \in L,b\in B} \end{equation*} is unitary. We prove that the associated fractal self-affine measure μ=μ(R,B)\mu = \mu (R,B) obtained by an infinite convolution of atomic measures μ(R,B)=δR−1B∗δR−2B∗δR−3B∗⋯\begin{equation*} \mu (R,B) = \delta _{R^{-1} B}\ast \delta _{R^{-2}B}\ast \delta _{R^{-3}B}\ast \cdots \end{equation*} is a spectral measure, i.e., it admits an orthonormal basis of exponential functions in L2(μ)L^2(\mu ). This settles a long-standing conjecture proposed by Jorgensen and Pedersen and studied by many other authors. Moreover, we also show that if we relax the Hadamard triple condition to an almost-Parseval-frame condition, then we obtain a sufficient condition for a self-affine measure to admit Fourier frames.