Probing deviations from general relativity with the Euclid spectroscopic survey