Computers are used all over the place to perform tasks ranging from sending an email to running some complicated numerical simulation. That is brilliant of course, because computers enable us to solve a lot of problems in the world in this way. At the same time, for some of those problems, not even powerful supercomputers are enough to get the result of the computation in any reasonable amount of time. An alternative that might be able to solve some of these problems very quickly are quantum computers. The operations performed by a quantum computer need to be faithful in order to get the right result of the quantum computation. However, nowadays quantum computers are fairly noisy, severely limiting their range of applicability in the near future. Various methods for quantum error correction have been developed, showing that, if error rates are below a certain threshold, one can make the computation as error-free as desired. However, while quantum error correction is starting to be tested in experiments, its performance has been mostly studied with respect to idealized error models. Furthermore, quantum error correction comes at the price of a substantial overhead in number of qubits and number of operations, especially if error rates are just barely below threshold. From a different perspective, error-mitigation techniques that do not need the full machinery of quantum correction have been put forward, fostering hope that noisy near-term devices might run useful applications even without quantum error correction. However, in either case the physical error rates of the fundamental operations are still high. In this thesis we focus on achieving lower error rates for some of the fundamental operations in a quantum computer, specifically for superconducting qubits, and we demonstrate the beneficial impact of these results on quantum error correction in a realistic setting. We develop error models that are physically motivated for superconducting qubits (reviewed in Chapter 2), based on the noise sources to which they are sensitive (reviewed in Chapter 3). The major elements of novelty in our models are the inclusion of leakage, quasi-static flux noise, and distortions of electronic signals. In Chapter 6 we discuss a flux-pulsing technique for controlled-phase gates, named Net Zero. In the first part, we show that the characteristic zero-integral feature protects from long-timescale distortions, echoes out flux noise and uses leakage interference to mitigate leakage, leading to a fast, high-fidelity gate. In the second part, we introduce an updated version of Net Zero, called Sudden Net Zero, that maintains the same advantages and adds easiness of tuneup and straightforward conditional-phase tunability. Diagnosing errors is crucial for correcting them and tuning up gates. In Chapter 7 we introduce Spectral Quantum Tomography, a tomographic method that can provide detailed information about errors in single- and two-qubit gates, in a way that is independent of state-preparation and measurement errors. In particular, we investigate the footprint of relaxation and dephasing, as well as leakage and non-Markovian noise. Leakage outside of the qubit computational subspace is particularly damaging for quantum error correcting codes, in particular stabilizer codes (reviewed in Chapter 4). Leakage-reduction units (reviewed in Chapter 5) can bring a leaked qubit back to the computational subspace, thus restoring part of the loss in performance. Based on the error model developed for two-qubit gates, we study the effect of leakage in quantum error correction using realistic density-matrix simulations. In Chapter 8 we use hidden Markov models to detect leakage in a transmon-qubit-based surface code and improve the logical fidelity by post-selection. The detection is based on recognizing patterns in the stabilizer measurements that can likely be attributed to leakage. In Chapter 9 we introduce a hardware-efficient leakage-reduction scheme to directly remove leakage in a scalable way that does not require extra qubits or time, leading to a reduction of the logical error rate. In particular, we propose two separate leakage-reduction units tailored for data and ancilla qubits, respectively. For data qubits, we apply a microwave pulse that transfers leakage to its dedicated readout resonator, where it quickly decays into the environment. For ancilla qubits, we use a microwave pulse that maps the leaked state to a computational state. These techniques for two-qubit gates, tomography and leakage mitigation contribute to reducing the error rates, benefiting quantum error correction as well as near-term devices. In the Conclusion we give an outlook on the potential challenges in superconducting quantum computing, including tunable couplers, real-time decoding and physical error rates in large devices.