The electronic properties of heterostructures of atomically thin van der Waals crystals can be modified substantially by moiré superlattice potentials from an interlayer twist between crystals1,2. Moiré tuning of the band structure has led to the recent discovery of superconductivity3,4 and correlated insulating phases5 in twisted bilayer graphene (TBG) near the ‘magic angle’ of twist of about 1.1 degrees, with a phase diagram reminiscent of high-transition-temperature superconductors. Here we directly map the atomic-scale structural and electronic properties of TBG near the magic angle using scanning tunnelling microscopy and spectroscopy. We observe two distinct van Hove singularities (VHSs) in the local density of states around the magic angle, with an energy separation of 57 millielectronvolts that drops to 40 millielectronvolts with high electron/hole doping. Unexpectedly, the VHS energy separation continues to decrease with decreasing twist angle, with a lowest value of 7 to 13 millielectronvolts at a magic angle of 0.79 degrees. More crucial to the correlated behaviour of this material, we find that at the magic angle, the ratio of the Coulomb interaction to the bandwidth of each individual VHS (U/t) is maximized, which is optimal for electronic Cooper pairing mechanisms. When doped near the half-moiré-band filling, a correlation-induced gap splits the conduction VHS with a maximum size of 6.5 millielectronvolts at 1.15 degrees, dropping to 4 millielectronvolts at 0.79 degrees. We capture the doping-dependent and angle-dependent spectroscopy results using a Hartree–Fock model, which allows us to extract the on-site and nearest-neighbour Coulomb interactions. This analysis yields a U/t of order unity indicating that magic-angle TBG is moderately correlated. In addition, scanning tunnelling spectroscopy maps reveal an energy- and doping-dependent three-fold rotational-symmetry breaking of the local density of states in TBG, with the strongest symmetry breaking near the Fermi level and further enhanced when doped to the correlated gap regime. This indicates the presence of a strong electronic nematic susceptibility or even nematic order in TBG in regions of the phase diagram where superconductivity is observed.