We study the joint determination of the lag length, the dimension of the cointegrating space andthe rank of the matrix of short-run parameters of a vector autoregressive (VAR) model using modelselection criteria. We consider model selection criteria which have data-dependent penalties aswell as t… he traditional ones. We suggest a new two-step model selection procedure which is ahybrid of traditional criteria and criteria with data-dependant penalties and we prove its consistency.Our Monte Carlo simulations measure the improvements in forecasting accuracy that can arisefrom the joint determination of lag-length and rank using our proposed procedure, relative to anunrestricted VAR or a cointegrated VAR estimated by the commonly used procedure of selecting thelag-length only and then testing for cointegration. Two empirical applications forecasting Brazilianinflation and U.S. macroeconomic aggregates growth rates respectively show the usefulness of themodel-selection strategy proposed here. The gains in different measures of forecasting accuracy aresubstantial, especially for short horizons.