We apply equilibrium statistical mechanics, based upon the conservation of energy and potential enstrophy, to the mass density distribution within the ocean, using a Monte Carlo method that conserves the buoyancy of each fluid particle. The equilibrium state resembles the buoyancy structure actually observed.