This paper aims to improve the capability of genetic programming to tackle the evolution of cooperation: evolving multiple partial solutions that collaboratively solve structurally and functionally complex problems. A multilevel genetic programming approach is presented based on a new computational multilevel selection framework [19]. This approach considers biological group selection theory to encourage cooperation, and a new cooperation operator to build solutions hierarchically. It extends evolution from individuals to multiple group levels, leading to good performance on both individuals and groups. The applicability of this approach is evaluated on 7 multi-class classification problems with different features, such as non-linearity, skewed data distribution and large feature space. The results, when compared to other cooperative evolutionary algorithms in the literature, demonstrate that this approach improves solution accuracy and consistency, and simplifies solution complexity. In addition, the problem is decomposed as a result of evolution without human interference.