Catalyzes the hydrolysis of trehalose 6-phosphate to trehalose and phosphate; prevents the accumulation of toxic levels of trehalose 6-phosphate. alpha,alpha-trehalose 6-phosphate + H2O = alpha,alpha-trehalose + phosphate Binds 1 Mg(2+) ion per subunit. Inhibited by trehalose 6-sulfate. kcat is 24 sec(-1) for trehalose 6-phosphate. Belongs to the gob-1 trehalose phosphatase family.