The eighth object of Messier's catalogue is usually associated with the Lagoon Nebula, however it is not completely correct.
The Lagoon Nebula, which is about 4100 light-years from us, was discovered more than a century before Messier. The Italian astronomer Giovanni Battista Hodierna discovered it before 1654. In 1764 Messier added the eighth object to his catalogue, which object we identify as The Lagoon Nebula, a bit incorrectly. Messier describes it as an object that looked like a nebula when observed through a small telescope, but that appears as a group of tiny stars in larger instruments. This is the description of an open cluster, not of a nebula. Messier probably referred to NGC 6530, based on the coordinates he recorded. At the end of the description he separately mentions a faint nebula around the nearby star (9 Sagittarii), which is the brightest region of The Lagoon Nebula. So Messier meant the cluster as M8 in his catalogue, and mentioned the nebula only as a nearby object. Since then it has turned out that the nebula is much more extended and that the cluster seems to be part of it.
Like most of the emission nebulae, Lagoon Nebula is a giant interstellar hydrogen cloud, in which star formation happened in the past and still happening in the present. The strong ionising radiation emitted by young stars formed of the cloud is making the remaining gas glow. The name Lagoon is coming from the dark strip crossing the nebula near to the centre of the image, which resembles a lagoon when observed through a telescope. The strip itself is a somewhat denser lobe of the cloud extending into the foreground and absorbing light coming from behind.
Several smaller dark patches can be observed in the image, apart from the strip in the middle. They too are dense blobs of gas absorbing light from their background just like the "lagoon". These compact regions are called Bok globules. They are the densest part of the cloud, contracting rapidly due to their own gravity until they collapse and new stars form of them. Edward Emerson Barnard recorded three of such globules in the Lagoon Nebula: Barnard 88, Barnard 89 and Barnard 296.
The brightest part of the nebula was given the name Hourglass by John Herschel. There are very hot and young stars in that part of the cloud, and new stars are being formed.
Right next to Hourglass is the star 9 Sagittarii which was mentioned by Messier in description of M8. It is a binary system having two giant stars orbiting each other. One of them is 50 times more massive than our Sun, the other one is "only" 30 times. Each of them is a couple of hundred-thousand times brighter than the Sun, so they are massively contributing to the ionisation of the cloud.
In a study published in 2005, images taken by Hubble Space Telescope, near infrared images taken by the Las Campañas Observatory in Chile and spectrograms recorded by the New Technology Telescope were analysed, and four Herbig-Haro objects have been identified in the Hourglass. Unfortunately these objects are not visible in this picture, but the nearby HH 213 is.
Herbig-Haro objects are newly formed stars still having the disc of remaining matter around them aligned in the plane of rotation. The matter in these discs is spiralling towards the star and - perhaps due to strong magnetic fields - gets ejected in focused jets along the star's rotational axis. The velocity in these jets can reach a couple of hundred kilometres per second. The jets colliding with interstellar medium loose speed due to collision and heat up enough to get the gas atoms in them ionised. Those ionised atoms then emit light in the same way as emission nebulae do.