We present a new method for determining pulse imperfections and improving the single-gate fidelity in a superconducting qubit. By applying consecutive positive and negative pi pulses, we amplify the qubit evolution due to microwave pulse distortions, which causes the qubit state to rotate around an axis perpendicular to the intended rotation axis. Measuring these rotations as a function of pulse period allows us to reconstruct the shape of the microwave pulse arriving at the sample. Using the extracted response to predistort the input signal, we are able to reduce the average error per gate by 37%, which enables us to reach an average single-qubit gate fidelity higher than 0.998.