A study of the lineshape of the χc1(3872) state is made using a data sample corresponding to an integrated luminosity of 3 fb-1 collected in pp collisions at center-of-mass energies of 7 and 8 TeV with the LHCb detector. Candidate χc1(3872) and ψ(2S) mesons from b-hadron decays are selected in the J/ψπ+π- decay mode. Describing the lineshape with a Breit-Wigner function, the mass splitting between the χc1(3872) and ψ(2S) states, Δm, and the width of the χc1(3872) state, ΓBW, are determined to be Δm=185.598±0.067±0.068 MeV,ΓBW=1.39±0.24±0.10 MeV, where the first uncertainty is statistical and the second systematic. Using a Flatté-inspired model, the mode and full width at half maximum of the lineshape are determined to be mode=3871.69-0.04-0.13+0.00+0.05 MeV,FWHM=0.22-0.06-0.13+0.07+0.11 MeV. An investigation of the analytic structure of the Flatté amplitude reveals a pole structure, which is compatible with a quasibound D0D¯∗0 state but a quasivirtual state is still allowed at the level of 2 standard deviations.