  We estimate the mass of the Milky Way (MW) within 21.1 kpc using the
kinematics of halo globular clusters (GCs) determined by Gaia. The second Gaia
data release (DR2) contained a catalogue of absolute proper motions (PMs) for a
set of Galactic GCs and satellite galaxies measured using Gaia DR2 data. We
select from the catalogue only halo GCs, identifying a total of 34 GCs spanning
$2.0 < r < 21.1$ kpc, and use their 3D kinematics to estimate the anisotropy
over this range to be $\beta = 0.46^{+0.15}_{-0.19}$, in good agreement, though
slightly lower than, a recent estimate for a sample of halo GCs using HST PM
measurements further out in the halo. We then use the Gaia kinematics to
estimate the mass of the MW inside the outermost GC to be $M(< 21.1
\mathrm{kpc}) = 0.21^{+0.04}_{-0.03} 10^{12} \mathrm{M_\odot}$, which
corresponds to a circular velocity of $v_\mathrm{circ}(21.1 \mathrm{kpc}) =
206^{+19}_{-16}$ km/s. The implied virial mass is $M_\mathrm{virial} =
1.28^{+0.97}_{-0.48} 10^{12} \mathrm{M_\odot}$. The error bars encompass the
uncertainties on the anisotropy and on the density profile of the MW dark halo,
and the scatter inherent in the mass estimator we use. We get improved
estimates when we combine the Gaia and HST samples to provide kinematics for 46
GCs out to 39.5 kpc: $\beta = 0.52^{+0.11}_{-0.14}$, $M(< 39.5 \mathrm{kpc}) =
0.42^{+0.07}_{-0.06} 10^{12} \mathrm{M_\odot}$, and $M_\mathrm{virial} =
1.54^{+0.75}_{-0.44} 10^{12} \mathrm{M_\odot}$. We show that these results are
robust to potential substructure in the halo GC distribution. While a wide
range of MW virial masses have been advocated in the literature, from below
$10^{12} \mathrm{M_\odot}$ to above $2 \times 10^{12}\mathrm{M_\odot}$, these
new data imply that an intermediate mass is most likely.
