The block bootstrap for time series consists in randomly resampling bl
ocks of consecutive values of the given data and aligning these blocks
into a bootstrap sample. Here we suggest improving the performance of
this method by aligning with higher likelihood those blocks which mat
ch at their ends. This is achieved by resampling the blocks according
to a Markov chain whose transitions depend on the data. The matching a
lgorithms that we propose take some of the dependence structure of the
data into account. They are based on a kernel estimate of the conditi
onal lag one distribution or on a fitted autoregression of small order
. Numerical and theoretical analyses in the case of estimating the var
iance of the sample mean show that matching reduces bias and, perhaps
unexpectedly, has relatively little effect on variance. Our theory ext
ends to the case of smooth functions of a vector mean.