Control of spin alignment in magnetic materials is crucial for developing switching devices. In molecular magnets, magnetic anisotropy can be rationally controlled by varying their ligands that allow tuning of ligand field splitting energy. However, the inherent weak magnetic interaction between spins or spin-cluster results in spin reorientation (SR) occurring only at low temperatures. Here, we show that layered perovskite oxyfluoride Pb3Fe2O5F2 exhibits a SR transition at 380 K, with the magnetic moments changing from perpendicular to parallel to the c-axis. It is found that the SR is caused by a ferroelectric-like phase transition, where the magnetic HOMO-LUMO interaction changes upon the structural transition due to the concerted effect of the heteroleptic FeO5F coordination and the steric effect of Pb. This finding indicates that the design of spin orientation by local coordination environment, which is common in molecular magnets, can be extended to extended oxides by introducing different anions.