PSR J1738+0333 is one of the four millisecond pulsars known to be orbited by a white dwarf companion bright enough for optical spectroscopy. Of these, it has the shortest orbital period, making it especially interesting for a range of astrophysical and gravity related questions. We present a spectroscopic and photometric study of the white dwarf companion and infer its radial-velocity curve, effective temperature, surface gravity and luminosity. We find that the white dwarf has properties consistent with those of low-mass white dwarfs with thick hydrogen envelopes, and use the corresponding mass–radius relation to infer its mass; M⊙. Combined with the mass ratio q= 8.1 ± 0.2 inferred from the radial velocities and the precise pulsar timing ephemeris, the neutron star mass is constrained to M⊙. Contrary to expectations, the latter is only slightly above the Chandrasekhar limit. We find that, even if the birth mass of the neutron star was only 1.20 M⊙, more than 60 per cent of the matter that left the surface of the white dwarf progenitor escaped the system. The accurate determination of the component masses transforms this system in a laboratory for fundamental physics by constraining the orbital decay predicted by general relativity. Currently, the agreement is within 1σ of the observed decay. Further radio timing observations will allow precise tests of white dwarf models, assuming the validity of general relativity.