The FASER experiment at the LHC is designed to search for light, weakly-interacting particles produced in proton-proton collisions at the ATLAS interaction point that travel in the far-forward direction. The first results from a search for dark photons decaying to an electron-positron pair, using a dataset corresponding to an integrated luminosity of 27.0 fb-1 collected at centre-of-mass energy √s=13.6 TeV in 2022 in LHC Run 3, are presented. No events are seen in an almost background-free analysis, yielding world-leading constraints on dark photons with couplings ε~2x10-5-1x10-4 and masses ~17MeV-70MeV. The analysis is also used to probe the parameter space of a massive gauge boson from a U(1)B-L model, with couplings gB-L ~5x10-6-2x10-5 and masses ~15MeV-40MeV excluded for the first time.