It is the same effect as a suction cup, just on a slightly less pronounced scale. The key is that, as you lift the cup, the water sticks to the glass, preventing new air from coming into the glass. Thus, as you lift, the pressure decreases inside the cup slightly, and you get the sticking effect you mention. This effect continues until the surface tension effects from the water can no longer hold the shape of the water against the air pressure difference, and the seal breaks.
For an extreme version of this, fill a sink full of water and put a cup in it. Get it so that the cup is upside down and mostly (or completely) full of water, and then lift out of the water. You'll find that the low air pressure in the cup can actually hold up several inches of water as you pull the cup higher and higher, until the rim of the glass finally gets close enough to the surface of the water to permit the glass to pull air in and break the seal.