Strong gravitational lensing magnifies the flux from distant galaxies, allowing us to detect emission lines that would otherwise fall below the detection threshold for medium-resolution spectroscopy. Here we present the detection of temperature-sensitive oxygen emission lines from three galaxies at 2<z<3.5, which enables us to directly determine the oxygen abundances and thereby double the number of galaxies at z>2 for which this has been possible. The three galaxies have ~10% solar oxygen abundances in agreement with strong emission line diagnostics. Carbon and nitrogen ratios relative to oxygen are sub-solar as expected for young metal-poor galaxies. Two of the galaxies are Lya emitters with rest-frame equivalent widths of 20 A and 40 A, respectively, and their high magnification factors allow us for the first time to gain insight into the physical characteristics of high-redshift Lya emitters. Using constraints from the physical properties of the galaxies, we accurately reproduce their line profiles with radiative transfer models. The models show a relatively small outflow in agreement with the observed small velocity offsets between nebular emission and interstellar absorption lines.