The ESPRI project relies on the astrometric capabilities offered by the PRIMA facility of the Very Large Telescope Interferometer for the discovery and study of planetary systems. Our survey consists of obtaining high-precision astrometry for a large sample of stars over several years and to detect their barycentric motions due to orbiting planets. We present the operation principle, the instruments implementation, and the results of a first series of test observations. A comprehensive overview of the instrument infrastructure is given and the observation strategy for dual-field relative astrometry is presented. The differential delay lines, a key component of the PRIMA facility which was delivered by the ESPRI consortium, are described and their performance within the facility is discussed. Observations of bright visual binaries are used to test the observation procedures and to establish the instruments astrometric precision and accuracy. The data reduction strategy for astrometry and the necessary corrections to the raw data are presented. Adaptive optics observations with NACO are used as an independent verification of PRIMA astrometric observations. The PRIMA facility was used to carry out tests of astrometric observations. The astrometric performance in terms of precision is limited by the atmospheric turbulence at a level close to the theoretical expectations and a precision of 30 micro-arcseconds was achieved. In contrast, the astrometric accuracy is insufficient for the goals of the ESPRI project and is currently limited by systematic errors that originate in the part of the interferometer beamtrain which is not monitored by the internal metrology system. Our observations led to the definition of corrective actions required to make the facility ready for carrying out the ESPRI search for extrasolar planets.