Mediation occurs when a third variable (the mediator) explains the relationship between the independent and dependent variables. Moderation occurs when the relationship between the independent and dependent variables depends on a third variable (the moderator).