It works because the static discharge no longer occurs as a spark on your finger. But in case you get out of your car the "wrong" way, you can still avoid most of the pain by holding a key (with as much of your hand as possible) and touch your car with the key. Now the spark is between the key and the car, not the car and your hand.