In most situations, you will reduce your chance of injury if you:
DROP down onto your hands and knees (before the earthquake knocks you down). This position protects you from falling but allows you to still move if necessary.
COVER your head and neck (and your entire body if possible) under a sturdy table or desk. If there is no shelter nearby, only then should you get down near an interior wall (or next to low lying furniture that won’t fall on you), and cover your head and neck with your arms and hands.
HOLD ON to your shelter (or your head and neck) until the shaking stops. Be prepared to move with your shelter if the shaking shifts it around.