Cold water is always more dense than warm water. This allows warm water to "float" on top of cold water, a phenomenon that occurs every day in the world's oceans.
The reason that warm water is less dense than cold water is the heat itself. When heat is introduced to water (from a source like the Sun), the molecules of water are excited by this new source of energy. They begin moving faster, so when they bump into one another, they bounce further away. This increased space between the fast-moving molecules decreases the density.
Cold water, by contrast, is much more dense. This is because without heat (energy), the water molecules have nothing to fuel fast movement. Cold water molecules are therefore more sluggish, so that when they do bump into one another, they don't go ricocheting off in opposite directions. It is more like nudging one another and slowly pulling back. Therefore, the molecules aren't forced apart by their own momentum, and more can coexist together in a smaller space, so they are packed together more tightly--hence, an increased density.
Because warm water is less dense, when the two meet, warm water always rises to the top. This often perpetuates the cycle, because, once it is on the surface, warm water can often gain further heat from sunlight. This means it only gets hotter and less dense, keeping it afloat on top of the cold water on the bottom.
Masses of warm water floating on top of cold water occur every day in the world's oceans. Given currents, warm, tropical water can be shuttled toward the poles in a motion like a conveyor belt, with cold waters underneath. The divide in temperatures is called thermoclime. The Gulf Stream is an example of this phenomenon, and this cycle of bringing warm tropical water up can also affect weather. London, for instance, is not as cold as Calgary, even though it is the same latitude, because it gets the benefit of the Gulf Stream. Ocean water does not always move this peacefully, though. Sometimes, when hot and cold water (and air masses) meet, the result is a storm or even a hurricane.