Hmm, the third bullet of the Sentinel feat says when the creature "makes an attack", not specifying what type of attack. Since using spiritual weapon requires making a melee spell attack, it would seem that Sentinel does apply.
Note: casting a spell that targets another creature is not considered an attack unless an attack roll is made. So Sentinel wouldn't apply to a creature casting vicious mockery or sacred flame. Nor would it apply if the creature casts spiritual weapon, but chooses to not make the spell attack. But since Sentinel simply refers to "attack", not a specific type of attack, it appears that it would apply to any spell using an attack roll.
Sentinel Feat
You have mastered techniques to take advantage of every drop in any enemy’s guard, gaining the following benefits:
• When you hit a creature with an opportunity attack, the creature’s speed becomes 0 for the rest of the turn.
• Creatures provoke opportunity attacks from you even if they take the Disengage action before leaving your reach.
• When a creature within melee range of you makes an attack against a target other than you (and that target doesn’t have this feat), you can use your reaction to make a melee weapon attack against the attacking creature.
SPIRITUAL WEAPON
2nd-level evocation
Casting Time: 1 bonus action
Range: 60 feet
Components: V, S
Duration: 1 minute
You create a floating, spectral weapon within range that lasts for the duration or until you cast this spell again. When you cast the spell, you can make a melee spell attack against a creature within 5 feet of the weapon. On a hit, the target takes force damage equal to 1d8 + your spellcasting ability modifier.
As a bonus action on your turn, you can move the weapon up to 20 feet and repeat the attack against a creature within 5 feet of it.
The weapon can take whatever form you choose. Clerics of deities who are associated with a particular weapon (as St. Cuthbert is known for his mace and Thor for his hammer) make this spell's effect resemble that weapon.
At Higher Levels. When you cast this spell using a spell slot of 3rd level or higher, the damage increases by 1d8 for every two slot levels above the 2nd.