We have undertaken an extensive study of X-ray data from the accreting millisecond pulsar XTE J1751–305 observed by RXTE and XMM-Newton during its 2002 outburst . In all aspects this source is similar to a prototypical millisecond pulsar SAX J1808.4–3658 , except for the higher peak luminosity of 13 per cent of Eddington , and the optical depth of the hard X-ray source larger by factor \sim 2 . Its broad-band X-ray spectrum can be modelled by three components . We interpret the two soft components as thermal emission from a colder ( kT \sim 0.6 keV ) accretion disc and a hotter ( \sim 1 keV ) spot on the neutron star surface . We interpret the hard component as thermal Comptonization in plasma of temperature \sim 40 keV and optical depth of \sim 1.5 in a slab geometry . The plasma is heated by the accretion shock as the material collimated by the magnetic field impacts on to the surface . The seed photons for Comptonization are provided by the hotspot , not by the disc . The Compton reflection is weak and the disc is probably truncated into an optically thin flow above the magnetospheric radius . Rotation of the emission region with the star creates an almost sinusoidal pulse profile with rms amplitude of 3.3 per cent . The energy-dependent soft phase lags can be modelled by two pulsating components shifted in phase , which is naturally explained by a different character of emission of the optically thick spot and optically thin shock combined with the action of the Doppler boosting . The observed variability amplitude constrains the hotspot to lie within 3–4 \degr of the rotational pole . We estimate the inner radius of the optically thick accreting disc of about 40 km . In that case , the absence of the emission from the antipodal spot , which can be blocked by the accretion disc , gives the inclination of the system to be \gtrsim 70 \degr .