This paper considers a feedback control law that achieves attitude stabilization for Earth-pointing spacecraft using only magnetorquers as torque actuators. The control law is proportional derivative (PD)-like with matrix gains, and it guarantees asymptotic stability. The PD matrix gains are determined through the numerical solution of a periodic linear quadric regulator problem. A case study shows the effectiveness of the considered control law, and specifically of the gain selection method, in a simplified simulation scenario.