Detailed modeling of the high-energy emission from gamma-ray binaries has been propounded as a path to pulsar wind physics . Fulfilling this ambition requires a coherent model of the flow and its emission in the region where the pulsar wind interacts with the stellar wind of its companion . We developed a code that follows the evolution and emission of electrons in the shocked pulsar wind based on inputs from a relativistic hydrodynamical simulation . The code is used to model the well-documented spectral energy distribution and orbital modulations from LS 5039 . The pulsar wind is fully confined by a bow shock and a back shock . The particles are distributed into a narrow Maxwellian , emitting mostly GeV photons , and a power law radiating very efficiently over a broad energy range from X-rays to TeV gamma rays . Most of the emission arises from the apex of the bow shock . Doppler boosting shapes the X-ray and VHE lightcurves , constraining the system inclination to i \approx 35 \degr . There is a tension between the hard VHE spectrum and the level of X-ray to MeV emission , which requires differing magnetic field intensities that are hard to achieve with a constant magnetisation \sigma and Lorentz factor \Gamma _ { p } of the pulsar wind . Our best compromise implies \sigma \approx 1 and \Gamma _ { p } \approx 5 \times 10 ^ { 3 } , respectively higher and lower than the typical values in pulsar wind nebulae . The high value of \sigma derived here , where the wind is confined close to the pulsar , supports the classical picture that has pulsar winds highly magnetised at launch . However , such magnetisations will require further investigations to be based on relativistic MHD simulations .