Gravity works by exerting an attractive force between objects with mass. The force depends on the mass of the objects and the distance between them.