The self-affine measure μM, D corresponding to M = diag[p1, p2, p3] (pj ∈ ℤ \ {0, ± 1}, j = 1, 2, 3) and D = {0, e1, e2, e3} in the space ℝ3 is supported on the three-dimensional Sierpinski gasket T(M, D), where e1, e2, e3 are the standard basis of unit column vectors in ℝ3. We shall determine the spectrality and non-spectrality of μM, D, and show that if pj ∈ 2ℤ \ {0, 2} for j = 1, 2, 3, then μM, D is a spectral measure, and if pj ∈ (2ℤ + 1) \ {±1} for j = 1, 2, 3, then μM, D is a non-spectral measure and there exist at most 4 mutually orthogonal exponential functions in L2(μM, D), where the number 4 is the best possible. This generalizes the known results on the spectrality of self-affine measures.