What’s the difference between a mediator and a moderator?

A mediator variable explains the process through which two variables are related, while a moderator variable affects the strength and direction of that relationship.