Gravitational wave searches for continuous-wave signals from neutron stars are especially challenging when the star ’ s spin frequency is unknown a priori from electromagnetic observations and wanders stochastically under the action of internal ( e.g . superfluid or magnetospheric ) or external ( e.g . accretion ) torques . It is shown that frequency tracking by hidden Markov model ( HMM ) methods can be combined with existing maximum likelihood coherent matched filters like the \mathcal { F } -statistic to surmount some of the challenges raised by spin wandering . Specifically it is found that , for an isolated , biaxial rotor whose spin frequency walks randomly , HMM tracking of the \mathcal { F } -statistic output from coherent segments with duration T _ { \text } { drift } = 10 d over a total observation time of T _ { \text } { obs } = 1 yr can detect signals with wave strains h _ { 0 } > 2 \times 10 ^ { -26 } at a noise level characteristic of the Advanced Laser Interferometer Gravitational Wave Observatory ( Advanced LIGO ) . For a biaxial rotor with randomly walking spin in a binary orbit , whose orbital period and semi-major axis are known approximately from electromagnetic observations , HMM tracking of the Bessel-weighted \mathcal { F } -statistic output can detect signals with h _ { 0 } > 8 \times 10 ^ { -26 } . An efficient , recursive , HMM solver based on the Viterbi algorithm is demonstrated , which requires \sim 10 ^ { 3 } CPU-hours for a typical , broadband ( 0.5-kHz ) search for the low-mass X-ray binary Scorpius X-1 , including generation of the relevant \mathcal { F } -statistic input . In a “ realistic ” observational scenario , Viterbi tracking successfully detects 41 out of 50 synthetic signals without spin wandering in Stage I of the Scorpius X-1 Mock Data Challenge convened by the LIGO Scientific Collaboration down to a wave strain of h _ { 0 } = 1.1 \times 10 ^ { -25 } , recovering the frequency with a root-mean-square accuracy of \leq 4.3 \times 10 ^ { -3 } Hz . PACS numbers 95.85.Sz , 97.60.Jd