Incompressible moderate-Reynolds-number flow in periodically grooved channels is investigated by direct numerical simulation using the spectral element method. For Reynolds numbers less than a critical value Rc the flow is found to approach a stable steady state, comprising an ‘outer’ channel flow, a shear layer at the groove lip, and a weak re-circulating vortex in the groove proper. The linear stability of this flow is then analysed, and it is found that the least stable modes closely resemble Tollmien–Schlichting channel waves, forced by Kelvin–Helmholtz shear-layer instability at the cavity edge. A theory for frequency prediction based on the Orr–Sommerfeld dispersion relation is presented, and verified by variation of the geometric parameters of the problem. The accuracy of the theory, and the fact that it predicts many qualitative features of low-speed groove experiments, suggests that the frequency-selection process in these flows is largely governed by the outer, more stable flow (here a channel), in contrast to most current theories based solely on shear-layer considerations. The instability of the linear mode for R > Rc is shown to result in self-sustained flow oscillations (at frequencies only slightly shifted from the originating linear modes), which again resemble (finite-amplitude) Tollmien-Schlichting modes driven by an unstable groove vortex sheet. Analysis of the amplitude dependence of the oscillations on degree of criticality reveals the transition to oscillatory flow to be a regular Hopf bifurcation.