Detailed characterization of exoplanets has begun to yield measurements of their atmospheric properties that constrain the planets ’ origins and evolution . For example , past observations of the dayside emission spectrum of the hot Jupiter WASP-12b indicated that its atmosphere has a high carbon-to-oxygen ratio ( C/O > 1 ) , suggesting it had a different formation pathway than is commonly assumed for giant planets . Here we report a precise near-infrared transmission spectrum for WASP-12b based on six transit observations with the Hubble Space Telescope /Wide Field Camera 3 . We bin the data in 13 spectrophotometric light curves from 0.84 - 1.67 \mu m and measure the transit depths to a median precision of 51 ppm . We retrieve the atmospheric properties using the transmission spectrum and find strong evidence for water absorption ( 7 \sigma confidence ) . This detection marks the first high-confidence , spectroscopic identification of a molecule in the atmosphere of WASP-12b . The retrieved 1 \sigma water volume mixing ratio is between 10 ^ { -5 } -10 ^ { -2 } , which is consistent with C/O > 1 to within 2 \sigma . However , we also introduce a new retrieval parameterization that fits for C/O and metallicity under the assumption of chemical equilibrium . With this approach , we constrain C/O to 0.5 ^ { +0.2 } _ { -0.3 } at 1 \sigma and rule out a carbon-rich atmosphere composition ( C/O > 1 ) at > 3 \sigma confidence . Further observations and modeling of the planet ’ s global thermal structure and dynamics would aid in resolving the tension between our inferred C/O and previous constraints . Our findings highlight the importance of obtaining high-precision data with multiple observing techniques in order to obtain robust constraints on the chemistry and physics of exoplanet atmospheres .