Aims. We aim to derive the physical properties of the recurrent nova T Pyx and the structure of the ejecta during the early stages of expansion of the 2011 outburst. Methods. The nova was observed with high resolution spectroscopy (R ≈ 65 000), from one day after discovery of the outburst and until the last visibility of the star at the end of May 2011. The interstellar absorption lines of Na I, Ca II, CH, CH + , and archival H I 21 cm emission line observations were used to determine a kinematical distance. Interstellar diffuse absorption features have been used to determine the extinction independent of previous assumptions. Sample Fe-peak line profiles show the optical depth and radial velocity evolution of the discrete components. Results. We propose a distance to T Pyx ≥ 4.5 kpc, with a strict lower limit of 3.5 kpc (the previously accepted distance). We derive an extinction, E(B − V) ≈ 0.5 ± 0.1, that is higher than previous estimates. The first observation, Apr. 15, displayed He I, He II, C III, and N III emission lines and a maximum velocity derived from the P Cyg profiles of the Balmer and He I lines of ≈2500 km s −1 that is characteristic of the fireball stage. These ions were undetectable in the second spectrum, Apr. 23, and we use the recombination time to estimate the mass of the ejecta, 10 −5 f M for a filling factor f . Numerous absorption-line systems were detected in the Balmer, Fe-peak, Ca II, and Na I lines, mirrored in broader emission-line components, that showed an "accelerated" displacement in velocity. We also show that the time sequence of these absorptions, which are common to all lines and arise only in the ejecta, can be described by a recombination front moving outward in the expanding gas without either a stellar wind or circumstellar collisions. By the end of May, the ejecta were showing signs of turning optically thin in the ultraviolet.