Your first indication that an earthquake is happening is that the ground is moving. You may not have much time to act. If you are indoors the best course of action is to stay there. Move to a place in the room that covers your body. Good choices are under a desk, strong table or along an interior wall. If there is no furniture look for a strong structural point in the room such as a door frame. Stay way from chandeliers, hanging lamps, mirrors, heavy furniture, heavy appliances, fireplaces and windows.
If you are cooking do your very best to try and shut off the stove before you take cover. Do not do this if the stove is on fire or if it is impractical in any way. Do not cross a shaking room to do this and watch out for flying pots and pans, especially if they are filled with hot oil.
If you are outdoors move to an open area where you are unlikely to be hit by falling buildings poles, power lines or trees. If you find yourself driving when the Earthquake, slow down and stop at the side of the road. Avoid parking your car near a building, bridge, large sign, tree or under power lines. Stay in your car until the shaking of the earth ends.
After the earthquake check to see if any one is near you. Attend to the safety of those around you and administer First Aid if necessary.
If you are in a building check it for damage and leave if it is too damaged to inhabit. If you smell or hear a gas leak leave immediately. If you can do it safely then turn off the gas at the source. If you have time open all of the windows and doors to let the gas out and reduce the risk of an explosion.
If all of the power is out unplug computers and major appliances to prevent shorts when the power is turned back on. If you see sparks or for smell burning wires turn off the electricity at the main fuse breaker as soon as you can. If you have to step through water to do this then wait for firemen or other professional rescue workers to do it for you.