If you are referring to the ocean -- the temperature at the surface is usually measured from space using infrared techniques. The basic idea is that any object emits radiation depending on its temperature (if it gets hot enough you can see it -- like a stove burner or a fire). For the most part, this radiation depends primarily on the temperature of the object. The technique is essentially the same as the modern remote thermometers used in doctor's offices these days that take the temperature of your eardrum without touching it.