  The majority of stars in today's Universe reside within spheroids, which are
bulges of spiral galaxies and elliptical galaxies. Their formation is still an
unsolved problem. Infrared/submm-bright galaxies at high redshifts have long
been suspected to be related to spheroids formation. Proving this connection
has been hampered so far by heavy dust obscuration when focusing on their
stellar emission or by methodologies and limited signal-to-noise ratios when
looking at submm wavelengths. Here we show that spheroids are directly
generated by star formation within the cores of highly luminous starburst
galaxies in the distant Universe. This follows from the ALMA submillimeter
surface brightness profiles which deviate significantly from those of
exponential disks, and from the skewed-high axis-ratio distribution, both
derived with a novel analysis technique. These galaxies are fully triaxial
rather than flat disks: scale-height ratios are 0.5 on average and $>0.6$ for
most spatially compact systems. These observations, supported by simulations,
reveal a cosmologically relevant pathway for in-situ spheroid formation through
starbursts likely preferentially triggered by interactions (and mergers) acting
on galaxies fed by non co-planar gas accretion streams.
