We propose a stock selection method that is based on a variable selection method used with principal component analysis in multivariate statistics. The method successively eliminates stocks with the lowest diversification potential from the investment pool, leaving the stocks with the highest diversification potential for a portfolio of that size. The output portfolio size can be adjusted to suit the investor's needs. Expected returns are not required as input to the selection process. We apply our method to stocks in the Australian Stock Exchange's ASX200 index and show that a portfolio of as little as fifteen stocks can closely replicate the behavior of the index. We show that the number of stocks required to form a diversified portfolio is not constant across time but varies with market conditions, decreasing when correlations between stock returns rise and increasing when they fall. The stock selection method can be combined with other stock and economic analysis in portfolio formation and management.