The P300-based speller is a well-established brain–computer interface for communication. It displays a matrix of objects on the computer screen, flashes each object in sequence, and looks for a P300 response induced by flashing the desired object. Most existing P300 spellers uses a fixed set of flash objects. We demonstrate that performance can be significantly improved by sequential selections from a hierarchy of flash sets containing variable number of objects. Theoretically, the optimal hierarchy of flash sets—with respect to a given statistical language model—can be found by solving a stochastic control problem of low computational complexity. Experimentally, statistical analysis demonstrates that the average time per output character at 85% accuracy is reduced by over 50% using our variable-flash-set approach as compared to traditional fixed-flash-set spellers.