Even on Earth gravity isn't the same everywhere! Newton already knew that on Earth the effective weight of an object was slightly smaller on the equator, due to the Earth's rotation. He was aware that if a pendulum clock--using gravity--was accurate in England, it ran slow after being moved to the equator. Portable clocks using a balance wheel, which rotated back and forth against a spring, did not have this problem. Such clocks used inertia, and they ultimately evolved into the accurate "chronometers" by which ships navigated (read "Longitude" by Dava Sobel).
Still, the easiest and most common way of measuring mass is by weighing, which uses gravity. In a two-pan balance, we compare the weight of an unknown object to that of a set of known weights: Because of this, mass is usually measured in kilograms, even though these are also units of weight. In a one-pan balance, like the one pictured here, the comparison weights are fixed, but by sliding them to different distances from the pivot, the same result is achieved.
Measuring Mass on a Space Station
In 1973 NASA put in orbit the space station Skylab, and its experiments included a careful monitoring of the health of the crew. One important quantity was the body mass of the astronauts. Here on Earth it would be called "body weight" and would be measured by weighing a person on scales. However, scales would not work on a space station. They use gravity, balancing its force on the astronaut's body against a calibrated spring or against the force of gravity on some calibrated weights.
It is not correct to say that gravity does not exist on an orbiting spacecraft (if it did, the spacecraft would fly away, never to return). Rather, in the "zero g" environment of the space station, gravity is already doing all it can in moving the station in its orbit, and none of it is evident inside the station. Since the orbit is curved, the first law is not violated by requiring a force to maintain it.
How can mass be measured there?
One gets a clue from clocks, all of which need some sort of device that gauges the passage of time. Pendulum clocks--always kept upright--use gravity, but mechanical wristwatches depend on a balance wheel, turning periodically back and forth--clockwise, then counter-clockwise, then clockwise again--against a spiral spring. Gravity is not involved. Modern electronic wristwatches replace the wheel with a vibrating quartz crystal, acting somewhat like a tuning fork: the motion is much faster, but transistor circuits can easily count the vibrations, which are very stable.