  We present astrometry and $BVI$ photometry, down to $V\simeq22$, of the very
young open cluster NGC6530, obtained from observations taken with the Wide
Field Imager camera at the MPG/ESO 2.2 m Telescope. Both the $V$ vs. $B-V$ and
the $V$ vs. $V-I$ color-magnitude diagrams (CMD) show the upper main sequence
dominated by very bright cluster stars, while, due to the high obscuration of
the giant molecular cloud surrounding the cluster, the blue envelopes of the
diagrams at $V\gtrsim 14$ are limited to the main sequence stars at the
distance of NGC6530. This particular structure of the NGC6530 CMD allows us to
conclude that its distance is about $d \simeq 1250$ pc, significantly lower
than the previous determination of d=1800 pc. We have positionally matched our
optical catalog with the list of X-ray sources found in a Chandra-ACIS
observation, finding a total of 828 common stars, 90% of which are pre-main
sequence stars in NGC6530. Using evolutionary tracks of Siess et al. (2000)},
mass and age values are inferred for these stars. The median age of the cluster
is about 2.3 Myr; in the mass range (0.6--4.0)$ M_\odot$, the Initial Mass
Function (IMF) shows a power law index $x=1.22\pm0.17$, consistent with both
the Salpeter index (1.35), and with the index derived for other young clusters
; towards smaller masses the IMF shows a peak and then it starts to decrease.
