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?
This works fine by RAW
There's no reason this wouldn't work, and generally meets the intent of both feats. Running through the checklist though:
So long as all the criteria above are met, then it works as expected.
However, by RAI...
The answer provided by rpeinhardt cites authoritative clarification that this isn't intended to be the case:
At this point, it's up to the DM with how to rule here.