A magnetic encoder with a novel arrangement of Hall-effect sensors is proposed for measurement of rotational angles. Three or six Hall-effect sensors are installed around a ring magnet to form an equilateral triangle. In contrast to a quadrature measurement, the equilateral arrangement is capable of eliminating harmonics of the third order and its multiples. Like quadrature measurements, even-order harmonics can also be canceled with a complementary set of Hall-effect sensors. As a result, measurement accuracy is greatly improved without resorting to lookup tables or sophisticated signal conditioning algorithms. The method is applied to a ring magnet revolving about an eccentric axis. Both numerical simulations and experimental results are conducted to verify its performance. It is shown that when a complementary set of Hall-effect sensors are used, the equilateral method yields a higher accuracy over the quadrature one by about 30 times in the simulations with ideal Hall-effect sensors. In the experiments with actual Hall-effect sensors, the proposed method still improves accuracy by about four to five times.