Similarly to analyzing the game in this thread, analyze the game backwards from last move.
Originally Posted by fifthrapiers
Form the board, which is effectively 8x6 because the queen cannot move to the left. See below. Starting from the lower right corner, mark a position as W for winning if a player can win outright from there or put the opponent into a losing position. Mark a position as L for losing if the player is forced to put the opponent into a winning position. Q denotes where the queen starts. X is the final position. A winning strategy is to move to one of the L positions reachable from Q.