Spatially resolved spectroscopy of infrared companions to T Tauri stars