The anomalous magnetic moment of the muon, a µ , has been measured with an overall precision of 540 ppb by the E821 experiment at BNL. Since the publication of this result in 2004 there has been a persistent tension of 3.5 standard deviations with the theoretical prediction of a µ based on the Standard Model. The uncertainty of the latter is dominated by the effects of the strong interaction, notably the hadronic vacuum polarisation (HVP) and the hadronic lightby-light (HLbL) scattering contributions, which are commonly evaluated using a data-driven approach and hadronic models, respectively. Given that the discrepancy between theory and experiment is currently one of the most intriguing hints for a possible failure of the Standard Model, it is of paramount importance to determine both the HVP and HLbL contributions from first principles. In this review we present the status of lattice QCD calculations of the leading-order HVP and the HLbL scattering contributions, a hvp µ and a hlbl µ . After describing the formalism to express a hvp µ and a hlbl µ in terms of Euclidean correlation functions that can be computed on the lattice, we focus on the systematic effects that must be controlled to achieve a first-principles determination of the dominant strong interaction contributions to a µ with the desired level of precision. We also present an overview of current lattice QCD results for a hvp µ and a hlbl µ , as well as related quantities such as the transition form factor for π 0 → γ * γ * . While the total error of current lattice QCD estimates of a hvp µ has reached the few-percent level, it must be further reduced by a factor ∼ 5 to be competitive with the data-driven dispersive approach. At the same time, there has been good progress towards the determination of a hlbl µ with an uncertainty at the 10 − 15%-level.