The Nizkor Project provides a good explanation:
Also Known as: Post Hoc Ergo Propter Hoc, False Cause, Questionable Cause, Confusing Coincidental Relationships With Causes
Description of Post Hoc
A Post Hoc is a fallacy with the following form:
1. A occurs before B.
2. Therefore A is the cause of B.
The Post Hoc fallacy derives its name from the Latin phrase "Post hoc, ergo propter hoc." This has been traditionally interpreted as "After this, therefore because of this." This fallacy is committed when it is concluded that one event causes another simply because the proposed cause occurred before the proposed effect. More formally, the fallacy involves concluding that A causes or caused B because A occurs before B and there is not sufficient evidence to actually warrant such a claim.
It is evident in many cases that the mere fact that A occurs before B in no way indicates a causal relationship. For example, suppose Jill, who is in London, sneezed at the exact same time an earthquake started in California. It would clearly be irrational to arrest Jill for starting a natural disaster, since there is no reason to suspect any causal connection between the two events. While such cases are quite obvious, the Post Hoc fallacy is fairly common because there are cases in which there might be some connection between the events. For example, a person who has her computer crash after she installs a new piece of software would probably suspect that the software was to blame. If she simply concluded that the software caused the crash because it was installed before the crash she would be committing the Post Hoc fallacy. In such cases the fallacy would be committed because the evidence provided fails to justify acceptance of the causal claim. It is even theoretically possible for the fallacy to be committed when A really does cause B, provided that the "evidence" given consists only of the claim that A occured before B. The key to the Post Hoc fallacy is not that there is no causal connection between A and B. It is that adequate evidence has not been provided for a claim that A causes B. Thus, Post Hoc resembles a Hasty Generalization in that it involves making a leap to an unwarranted conclusion. In the case of the Post Hoc fallacy, that leap is to a causal claim instead of a general proposition.
Not surprisingly, many superstitions are probably based on Post Hoc reasoning. For example, suppose a person buys a good luck charm, does well on his exam, and then concludes that the good luck charm caused him to do well. This person would have fallen victim to the Post Hoc fallacy. This is not to say that all "superstitions" have no basis at all. For example, some "folk cures" have actually been found to work.
Post Hoc fallacies are typically committed because people are simply not careful enough when they reason. Leaping to a causal conclusion is always easier and faster than actually investigating the phenomenon. However, such leaps tend to land far from the truth of the matter. Because Post Hoc fallacies are committed by drawing an unjustified causal conclusion, the key to avoiding them is careful investigation. While it is true that causes precede effects (outside of Star Trek, anyways), it is not true that precedence makes something a cause of something else. Because of this, a causal investigation should begin with finding what occurs before the effect in question, but it should not end there.
Examples of Post Hoc
1. I had been doing pretty poorly this season. Then my girlfriend gave me this neon laces for my spikes and I won my next three races. Those laces must be good luck...if I keep on wearing them I can't help but win!
2. Bill purchases a new PowerMac and it works fine for months. He then buys and installs a new piece of software. The next time he starts up his Mac, it freezes. Bill concludes that the software must be the cause of the freeze.
3. Joan is scratched by a cat while visiting her friend. Two days later she comes down with a fever. Joan concludes that the cat's scratch must be the cause of her illness.
4. The Republicans pass a new tax reform law that benefits wealthly Americans. Shortly thereafter the economy takes a nose dive. The Democrats claim that the the tax reform caused the economic woes and they push to get rid of it.
5. The picture on Jim's old TV set goes out of focus. Jim goes over and strikes the TV soundly on the side and the picture goes back into focus. Jim tells his friend that hitting the TV fixed it.
6. Jane gets a rather large wart on her finger. Based on a story her father told her, she cuts a potato in half, rubs it on the wart and then buries it under the light of a full moon. Over the next month her wart shrinks and eventually vanishes. Jane writes her father to tell him how right he was about the cure.