We have used the US VLBI network to investigate the circularly polarized radio core previously identified around the young B3 star S1 in rho Ophiuchi. Our 6 cm VLBI data indicate that the source is clearly detected and very likely resolved. The measured angular diameter (1.6(-0.6)+0.4 mas, equivalent to 12.8(-4.8)+2.4 stellar radii) and brightness temperature (1.5(+2.4)-0.4 x 10(8) K) are consistent with the emission being gyrosynchrotron radiation from mildly relativistic electrons. This is the first VLBI detection of a young stellar object still embedded in a star-forming region. The presence of a large-scale, organized magnetosphere around S1, several stellar radii in size, which was predicted in our previous paper (Andre et al.) by analogy with chemically peculiar magnetic stars, is now directly established. The present observations, together with previous VLBI observations of the Bp star sigma Ori E (Phillips & Lestrade), improve our knowledge on the structure of the magnetospheres around magnetic stars. A simple model, based on a pole-on dipolar magnetic field of approximately 2 kG at the stellar surface, appears to be consistent with the main observed characteristics of the S1 magnetosphere (radio size and spectrum, and X-ray emission). An important feature of this model is that it takes into account the influence of the X-ray emitting plasma on the radio emission. As other young radio stars, of lower mass but sharing several properties of S1, have been found in rho Oph, we suggest that S1 may be representative of a new type of young stellar object characterized by very extended magnetic fields.