Always have a sword in your inventory, or at least have the items to make one.

When a zombie is after you you should always be able to fight him, when you cant defeat him? Run, just run and make sure you find some items to make a sword defeat him anyway because a zombie never comes alone, there will always be a few more just around the corner and you need to be prepared.

This Minecraft animations shows you why you should always be prepared.