This question already has an answer here:
The Polearm Master feat (PHB, p. 168) says:
While you are wielding a glaive, halberd, pike, quarterstaff or spear, other creatures provoke an opportunity attack from you when they enter the reach you have with that weapon.
The War Caster feat (PHB, p. 170) says:
When a hostile creature's movement provokes an opportunity attack from you, you can use your reaction to cast a spell at the creature, rather than making an opportunity attack. The spell must have a casting time of 1 action and must target only that creature.
Assume that I'm a wizard, with both Polearm Master and War Caster, and I'm holding a staff of power (it's a magic quarterstaff).
Can I cast a spell (with a casting time of 1 action) as a reaction when a creature enters my quarterstaff's reach, targeting only that creature?