  The production of $\pi^\pm$, ${\rm K}^\pm$, and $(\overline{\rm p})$p is
measured in pp collisions at $\sqrt{s}=13$ TeV in different topological
regions. Particle transverse momentum ($p_{\rm T}$) spectra are measured in the
``toward'', ``transverse'', and ``away'' angular regions defined with respect
to the direction of the leading particle in the event. While the toward and
away regions contain the fragmentation products of the near-side and away-side
jets, respectively, the transverse region is dominated by particles from the
Underlying Event (UE). The relative transverse activity classifier, $R_{\rm
T}=N_{\rm T}/\langle N_{\rm T}\rangle$, is used to group events according to
their UE activity, where $N_{\rm T}$ is the measured charged-particle
multiplicity per event in the transverse region and $\langle N_{\rm T}\rangle$
is the mean value over all the analysed events. The first measurements of
identified particle $p_{\rm T}$ spectra as a function of $R_{\rm T}$ in the
three topological regions are reported. The yield of high transverse momentum
particles relative to the $R_{\rm T}$-integrated measurement decreases with
increasing $R_{\rm T}$ in both the toward and away regions, indicating that the
softer UE dominates particle production as $R_{\rm T}$ increases and validating
that $R_{\rm T}$ can be used to control the magnitude of the UE. Conversely,
the spectral shapes in the transverse region harden significantly with
increasing $R_{\rm T}$. This hardening follows a mass ordering, being more
significant for heavier particles. The $p_{\rm T}$-differential particle ratios
$({\rm p+\overline{p}})/(\pi^+ +\pi^-)$ and $({\rm K^+ +K^-})/(\pi^+ +\pi^-)$
in the low UE limit $(R_{\rm T}\rightarrow 0)$ approach expectations from Monte
Carlo generators such as PYTHIA 8 with Monash 2013 tune and EPOS LHC, where the
jet-fragmentation models have been tuned to reproduce ${\rm e^+ e^-}$ results.
