  This paper presents the performance of the ATLAS muon reconstruction during
the LHC run with $pp$ collisions at $\sqrt{s}=7-8$ TeV in 2011-2012, focusing
mainly on data collected in 2012. Measurements of the reconstruction efficiency
and of the momentum scale and resolution, based on large reference samples of
$J/\psi\to \mu\mu$, $Z\to \mu\mu$ and $\Upsilon\to\mu\mu$ decays, are presented
and compared to Monte Carlo simulations. Corrections to the simulation, to be
used in physics analysis, are provided. Over most of the covered phase space
(muon $|\eta|<2.7$ and $5 \lesssim p_{\mathrm{T}} \lesssim 100$ GeV) the
efficiency is above $99\%$ and is measured with per-mille precision. The
momentum resolution ranges from $1.7\%$ at central rapidity and for transverse
momentum $p_{\mathrm{T}} \simeq 10$ GeV, to $4\%$ at large rapidity and
$p_{\mathrm{T}} \simeq 100$ GeV. The momentum scale is known with an
uncertainty of $0.05\%$ to $0.2\%$ depending on rapidity. A method for the
recovery of final state radiation from the muons is also presented.
