Summary. The system equation of a hidden Markov model is rewritten to label the components by order of appearance, and to make explicit the random behaviour of the number of components, mt. We argue that this reformulation is often a good way to achieve identifiability, as it facilitates the interpretation of the posterior density, and the estimation of the number of components that have appeared in a given sample. We develop a sequential Monte Carlo algorithm for estimating the reformulated model, which relies on particle filtering and Gibbs sampling. Our algorithm has a computational cost that is similar to that of a Markov chain Monte Carlo sampler and is much less likely to be affected by label switching, i.e. the possibility of becoming trapped in a local mode of the posterior density. The extension to transdimensional priors is also considered. The approach is illustrated by two real data examples.