Context. The circumstellar disk of the Herbig Fe star HD 142527 is host to several remarkable features including a warped inner disk, a 120 au-wide annular gap, a prominent dust trap and several spiral arms. A low-mass companion, HD 142527 B, was also found orbiting the primary star at ∼14 au. Aims. This study aims to better characterize this companion, which could help explain its impact on the peculiar geometry of the disk. Methods. We observed the source with VLT/SINFONI in H+K band in pupil-tracking mode. Data were post-processed with several algorithms based on angular differential imaging (ADI). Results. HD 142527 B is conspicuously re-detected in most spectral channels, which enables us to extract the first medium-resolution spectrum of a low-mass companion within 0 . 1 from its central star. Fitting our spectrum with both template and synthetic spectra suggests that the companion is a young M2.5±1.0 star with an effective temperature of 3500 ± 100 K, possibly surrounded with a hot (1700 K) circum-secondary environment. Pre-main sequence evolutionary tracks provide a mass estimate of 0.34 ± 0.06M , independent of the presence of a hot environment. However, the estimated stellar radius and age do depend on that assumption; we find a radius of 1.37 ± 0.05R (resp. 1.96 ± 0.10R ) and an age of 1.8 +1.2 −0.5 Myr (resp. 0.75 ± 0.25 Myr) in the case of the presence (resp. absence) of a hot environment contributing in H+K. Our new values for the mass and radius of the companion yield a mass accretion rate of 4.1-5.8 ×10 −9 M yr −1 (2-3% that of the primary). Conclusions. We have constrained the physical properties of HD 142527 B, thereby illustrating the potential for SINFONI+ADI to characterize faint close-in companions. The new spectral type makes HD 142527 B a twin of the well-known TW Hya T-Tauri star, and the revision of its mass to higher values further supports its role in shaping the disk.