We propose an optimal set of quantum gates for a singlet-triplet qubit in a double quantum dot with two electrons utilizing the $S$-$T_-$ subspace. Qubit rotations are driven by the applied magnetic field and an orthogonal field gradient provided by a micromagnet. We optimize the fidelity of this qubit as a function of magnetic fields, taking advantage of "sweet spots" where the rotation frequencies are independent of the energy level detuning, providing protection against charge noise. We simulate gate operations and qubit rotations in the presence of quasistatic noise from charge and nuclear spins as well as leakage to nonqubit states, and predict that in silicon quantum dots gate fidelities greater than $99\%$ can be achieved for two nearly-orthogonal rotation axes.