An hp-adaptive pseudospectral method is presented for numerically solving optimal control problems. The method presented in this paper iteratively determines the number of segments, the width of each segment, and the polynomial degree required in each segment in order to obtain a solution to a user-specified accuracy. Starting with a global pseudospectral approximation for the state, on each iteration the method determines locations for the segment breaks and the polynomial degree in each segment for use on the next iteration. The number of segments and the degree of the polynomial on each segment continue to be updated until a user-specified tolerance is met. The terminology ‘ hp’ is used because the segment widths (denoted h) and the polynomial degree (denoted p) in each segment are determined simultaneously. It is found that the method developed in this paper leads to higher accuracy solutions with less computational effort and memory than is required in a global pseudospectral method. Consequently, the method makes it possible to solve complex optimal control problems using pseudospectral methods in cases where a global pseudospectral method would be computationally intractable. Finally, the utility of the method is demonstrated on a variety of problems of varying complexity. Copyright © 2010 John Wiley & Sons, Ltd.