Here's some further background on accelerometers. In this case, we're using a mass on a spring to measure a car's forward acceleration. The acceleration is proportional to the extension of the spring, so by integrating the instantaneous extension of the spring (adjusted by the appropriate constant) the change in velocity and position can be obtained. This only holds true when the car is moving entirely horizontally – because then gravity is not a factor. All accelerometers work essentially like this - a proof mass and a restoring force.