We present optical and near-infrared (near-IR) spectroscopy of a z = 2.38 hyperluminous IR galaxy, covering the rest-frame wavelength range from 1000-5000 Angstrom. It appears to comprise two components separated by less than 1 arcsec on the sky (less than or similar to8 kpc); one component (B) is blue, the other (P) is red in rest-frame ultraviolet(UV)-optical colours. The combined system has a rest-frame luminosity of similar to8L*(V) and its rest-frame optical spectrum is characteristic of a Seyfert active galactic nucleus. However, its rest-frame UV spectrum exhibits striking features associated with young stars, including P-Cygni lines from stellar winds and blueshifted interstellar absorption lines indicative of a galactic outflow. Redshifts are derived from stellar photospheric lines in the UV and from narrow emission lines in the rest-frame optical, and these are compared to those measured for the molecular gas recently detected with the Institut de Radioastronomie Millimetrique (IRAM) interferometer. The offsets indicate that the far-IR emission is most likely associated with the near-IR source P, which hosts the Seyfert nucleus, while the UV-bright component B is blueshifted by 400 km s(-1). This suggests that the two components are probably merging and the resulting gravitational interactions have triggered the hyperluminous activity. Modelling of the UV spectral features implies that the starburst within the UV component of this system has been going on for at least similar to10 Myr. Assuming that the bolometrically-dominant obscured component has a similar lifetime, we estimate that it has so far formed a total stellar mass of similar to10(11) M.. If this star formation continues at its present level for substantially longer, or if this activity is repeated, then the present-day descendant of N2 850.4 will be a very luminous galaxy.