There's countless books written about Japanese etiquette. I would like to explain some of the most important rules for those of you who are visiting friends or would just like to be aware of how to act politely in Japanese society.
First, the shoes. It's crucial to remove your shoes when entering someone's house. They also come off before entering a hot spring (onsen), a school or even the toilet! After you take them off, set them so that the toes face out (towards the way you came in). If you are unsure of whether you should take your shoes off, just look around you. Are there some cheap-looking slippers? They're probably for guests. As a warning, never wear slippers or shoes on tatami (reed) mats! This is incredibly offensive and will cause gasps and require a big apology. As a general rule, don't take any holey socks to Japan because everyone will see.
If you want to visit someone or are meeting new co-workers or something to that effect, it's best to bring a small gift. I highly recommend bringing food from your home country. Japanese people particularly like things that are individually wrapped and aren't TOO foreign. Cookies and candies work best. Chocolate is well-loved here but may melt on the way so be careful.
To bow or not to bow? When meeting someone for the first time, watch their response. If they bow then you should offer a bow. And if they offer their hand then give them a handshake! Remember to keep your hands at your sides when you bow. Don't put them in prayer position; this is only common in Southeast Asia and would look absurd!
Also, a word about eating and toasts. When attending a formal dinner function, they may have placed all the food and drinks out. Even if your stomach is grumbling, do not partake of it until the toast! Have a glass of alcohol (or juice) ready and when everyone says 'Kanpai!' join in and raise your glass. Only drink and eat when you see everyone else doing it. To eat first would be very rude.
If someone is giving you a nice gift or a business card, accept it with both hands. As a general rule, if they're offering with both hands then be sure to take it with both hands and treat it respectfully.
Here's a few other notes:
-Slurping hot noodles is encouraged
-Be careful how you handle your chopsticks; don't use them to poke food or stick them straight up because it reminds them of funerals
-Someone may use a 'karate chop' when trying to get through a crowd; this is polite behavior
-Don't talk loudly or use a mobile while on a train; be aware of those around you
-Try not to blow your nose, especially around food
Aside from these rules, Japanese people won't expect you to know everything! They're very forgiving as long as you keep a positive attitude. If you think you are being treated poorly, don't assume the worst. Just try and have fun and keep a smile on!