The bright BL Lac object TXS 0506+056 is a most likely counterpart of the IceCube neutrino event EHE 170922A . The lack of this redshift prevents a comprehensive understanding of the modeling of the source . We present high signal-to-noise optical spectroscopy , in the range 4100-9000 Å , obtained at the 10.4m Gran Telescopio Canarias . The spectrum is characterized by a power law continuum and is marked by faint interstellar features . In the regions unaffected by these features , we found three very weak ( EW \sim 0.1 Å ) emission lines that we identify with [ O II ] 3727 Å , [ O III ] 5007 Å , and [ NII ] 6583 Å , yielding the redshift z = 0.3365 \pm 0.0010 .