When a hostile creature’s movement provokes an opportunity attack from you, you can use your reaction to cast a spell at that creature instead of making an opportunity attack. The spell must have a casting time of 1 action and target only that creature.
Once used, you can't use this feature again until you finish a short or long rest.