This is advice provided by the Red Cross:
Staying Safe Indoors
DROP, COVER and HOLD ON!
Move as little as possible – most injuries during earthquakes occur because of people moving around, falling and suffering sprains, fractures and head injuries.
Try to protect your head and torso.
If you are in bed, stay there, curl up and hold on, and cover your head.
Stay indoors until the shaking stops and you are sure it is safe to exit.
If you must leave a building after the shaking stops, use stairs rather than an elevator in case of aftershocks, power outages or other damage.
Be aware that smoke alarms and sprinkler systems frequently go off in buildings during an earthquake, even if there is no fire.
Before you leave any building check to make sure that there is no debris from the building that could fall on you.
Staying Safe Outdoors
Find a clear spot and drop to the ground. Stay there until the shaking stops.
Try to get as far away from buildings, power lines, trees, and streetlights as possible.
If you’re in a vehicle, pull over to a clear location and stop. Avoid bridges, overpasses and power lines if possible.
Stay inside with your seatbelt fastened until the shaking stops.
After the shaking has stopped, drive on carefully, avoiding bridges and ramps that may have been damaged.
If a power line falls on your vehicle, do not get out. Wait for assistance.
If you are in a mountainous area or near unstable slopes or cliffs, be alert for falling rocks and other debris as well as landslides.
After an earthquake
If you do nothing else:
If away from home, return only when authorities say it is safe to do so.
Check yourself for injuries and get first aid, if necessary, before helping injured or trapped persons.
After an earthquake, the disaster may continue. Expect and prepare for potential aftershocks, landslides or even a tsunami if you live on a coast.
Each time you feel an aftershock, DROP, COVER and HOLD ON.
Aftershocks frequently occur minutes, days, weeks and even months following an earthquake.
Look for and extinguish small fires. Fire is the most common hazard after an earthquake.
Check water, gas, and electric lines for damage. If any are damaged, shut off the valves. Check for the smell of gas. If you smell it, open all the windows and doors, leave immediately, and report it to the authorities (use someone else’s phone).
Stay out of damaged buildings.
Be careful around broken glass and debris.
Stay away from beaches. Tsunamis and seiches sometimes hit after the ground has stopped shaking.
Follow the emergency plan for your building if on a complex or the instructions of the person in charge.
Expect aftershocks
Emergency kit: It might be handy to keep an emergency kit safely stored away and that can be reached within seconds. These could include items, such as water, dried foods and canned foods, tracksuit, sports shoes, raincoat, sleeping bag and a blanket, first aid kit, medicines if needed, battery powered radio, torch – spare and correct size batteries for both, a whistle and in a separate waterproof envelope or carrier bag cash for urgent needs, photocopies of positive ID, and a list with telephone numbers of family and friends.