has a Google Maps mashup that shows vessel traffic and positions. Their FAQ describes how position data is collected:

The system is based on AIS (Automatic Identification System). As from December 2004, the International Maritime Organization (IMO) requires all vessels over 299GT to carry an AIS transponder on board, which transmits their position, speed and course, among some other static information, such as vessel’s name, dimensions and voyage details.