One of the most confusing concepts in research is the distinction between mediators and moderators.

A mediator ‘mediates’ the relationship between two variables (the independent and dependent variables). That is, the two variables are correlated, but their relationship completely depends on the mediator. That is, the mediator accounts for the relationship between the two variables. In a treatment outcome study, a mediator is what is thought to be responsible for the change (e.g., mechanism of change). Thus, the mediator causes the dependent variable (variable C), but it is itself caused by the independent variable (variable C). In the picture below, pathway C would equal zero in a fully mediated relationship.
A moderator is a variable that affects the relationship between two variables. That is, it interacts with the independent variable to create different effects on the independent variable. Thus, It modifies the relationship (whereas a mediator accounts for the relationship). In a treatment outcome study, a moderator is something that usually exists before the study begins. For example, IQ or gender might modify how a person does in treatment. In the figure below, there is a moderated relationship if pathway C is significant. That is, there is an interaction between the IV and the moderator.
In thinking about these concepts causally, a mediator is a variable that comes in between two variables. That is, it is caused by one and in turn causes the other. A moderator modifies the relationship between two variables and does not have to exist in the causal chain. Gender is a common example of a moderator in that people will behave differently depending on their gender.

For further reading:
Baron, R. M. & Kenny, D. A. (1986). The moderator-mediator variable distinction in social psychological research: Conceptual, strategic, and statistical considerations. Journal of Personality and Social Psychology, 51, 1173-1182.
MacKinnon, D. P.., Lockwood, C. M., Hoffman, J. M., West, S. G., & Sheets, V. (2002). A comparison of methods to test mediation and other intervening variable effects. Psychological Methods, 7, 83-104.