Stay away from glass, windows and objects that could fall on you, like shelves or cabinets. If you are in a public place, take cover. Do not rush for the doors with a panicked crowd. Do not get in an elevator. If outdoors, stay away from utility wires, buildings and street lights.
Aftershocks often occur after quakes and can cause weakened structures to fall down.
If you smell gas or hear a hissing sound, open a window and leave the building immediately. A gas line may have broken. Also be aware of the possibility of open electrical lines. Do not touch them. Put on shoes, as there will be broken glass inside buildings.