Target tracking of ground targets is a significant application of unmanned aerial vehicles (UAVs) in civil and military fields. There are two common modes for target tracking: over-flight tracking and standoff tracking. Each tracking method has a wide application prospect. However, many researchers have studied these two tracking methods separately and designed different guidance laws, which is not conducive to practical application. In this paper, a new guidance law based on sliding mode guidance (SMG) is proposed for tracking a stationary target, which is compatible with the two tracking modes. The stability and finite-time convergence of the guidance law are proved. Then, the guidance is extended to tracking a moving target. The numerical simulations are carried out for the tracking problems of ground targets, and the results verify the effectiveness of the proposed guidance law.