This paper proposes a localization method for wireless sensor nodes that utilize tri-directional coils for near-field magnetic induction (MI) communications. Taking advantage of magnetic field measurements of the tri-directional coils, the proposed localization algorithm uses only two anchor nodes to locate a sensor node in the 3-D space. Assuming each anchor node sequentially transmits the communication signal by three orthogonal Tx coils, and the sensor node receives the signals at the three orthogonal Rx coils simultaneously, the communication distance and the polar angles of transmission are estimated in a local coordinate system of the anchor node. These estimates from the two anchor nodes yield two sets of 8 possible locations of the sensor node. Then a Rotation Matrix (RM) between the transmitter and receiver is derived to narrow down to two possible location vectors with the opposite directions in each anchor node. Finally, we use the maximum likelihood method to estimate the accurate location from the two sets of two location vectors. Simulations results show that the proposed RM-based method can achieve high localization accuracy because the derived closed-form formula of distance estimation achieves good accuracy under large measurement errors.