Let P be a set of n points in real projective d-space, not all contained in a hyperplane, such that any d points span a hyperplane. An ordinary hyperplane of P is a hyperplane containing exactly d points of P. We show that if d≥4, the number of ordinary hyperplanes of P is at least (d−1n−1)−Od(n⌊(d−1)/2⌋) if n is sufficiently large depending on d. This bound is tight, and given d, we can calculate the exact minimum number for sufficiently large n. This is a consequence of a structure theorem for sets with few ordinary hyperplanes: For any d≥4 and K>0, if n≥CdK8 for some constant Cd>0 depending on d and P spans at most K(d−1n−1) ordinary hyperplanes, then all but at most Od(K) points of P lie on a hyperplane, an elliptic normal curve, or a rational acnodal curve. We also find the maximum number of (d+1)-point hyperplanes, solving a d-dimensional analogue of the orchard problem. Our proofs rely on Green and Tao's results on ordinary lines, our earlier work on the 3-dimensional case, as well as results from classical algebraic geometry.