The gist of this deal is to determine if the diamond finesse works before attacking spades. The outcome of the diamond finesse will determine how you play spades, keeping in mind if spades break 3–2, you should get home easily.
Win the opening lead in hand and try a diamond to the queen. Say the finesse wins. Now the idea is to make a safety play in spades, guarding against Q–10–x–x in either hand. The safety play is to cash the ♠K and assuming both follow low, cross to a heart and lead a low spade toward the jack. If West shows out, play the jack to East’s queen. If East returns a minor-suit card, you are in dummy to take the marked spade finesse (low to the 9). If East returns a heart, cross to the ♣A and take the spade finesse.
If West is the one with four spades, West does best to win the ♠Q at trick five and perhaps get out with a club to dummy’s ace. You counter by cashing the ♠J and then the ♦A knowing West still has the king. If West neglects to play the king, it is safe to ruff a diamond back to your hand in order to draw the last trump. If West plays the king, return to your hand with a heart to draw the last trump.
Say something closer to home happens: the diamond finesse loses. Now the idea is to give yourself the best play for five spade tricks. Best is to play West for the ♠Q, more exactly the blank queen, Q–x or Q–x–x. In all three cases, you are home if you start with a low spade from your hand intending to finesse the jack if West plays low. Leading low gains when West has the singleton queen, as it allows you to pick up the suit by eventually leading a low spade to the 9 after cashing the ♠J. Starting with the ace picks up the stiff queen in the East hand, but you remain with a spade loser. It is the stiff queen in the West hand you should be concerned with.