To tune the magnetic properties of hexagonal ferrites, a family of magnetoelectric multiferroic materials, by atomic-scale structural engineering, we studied the effect of structural distortion on the magnetic ordering temperature (TN). Using the symmetry analysis, we show that unlike most antiferromagnetic rare-earth transition-metal perovskites, a larger structural distortion leads to a higher TN in hexagonal ferrites and manganites, because the K3 structural distortion induces the three-dimensional magnetic ordering, which is forbidden in the undistorted structure by symmetry. We also revealed a near-linear relation between TN and the tolerance factor and a power-law relation between TN and the K3 distortion amplitude. Following the analysis, a record-high TN (185 K) among hexagonal ferrites was predicted in hexagonal ScFeO3 and experimentally verified in epitaxially stabilized films. These results add to the paradigm of spin-lattice coupling in antiferromagnetic oxides and suggests further tunability of hexagonal ferrites if more lattice distortion can be achieved.