In this paper we report an accurate optical method for measuring the azimuthal director angle and the azimuthal anchoring energy for a nematic liquid crystal. The method is fully automated and provides a direct measurement of the azimuthal angle. The experimental procedure exploits the dependence of the reflectivity tensor on the surface director orientation. The measurement of the azimuthal angle does not require any knowledge of the optical parameters of the nematic material or of the substrate, and provides an absolute accuracy better than 0.2 degrees in the whole range 0 degrees-360 degrees and a sensitivity of 0.01 degrees. If the optical parameters of both the nematic sample and the substrate are known, the surface polar angle can also be obtained from the experiment.