Particle Swarm Optimization (PSO) is an optimization technique that has been applied to solve various optimization problems. Its traditional strategy adopts elitism, in which only the personal and global best positions are utilized as leaders to guide all particles' update and discard other potentially excellent positions around which the global optimum may be found. In a human society, people fall into different classes. They tend to learn from better ones, not just from the best ones in the whole society. Inspired from the learning behavior in a human society, this work considers particles in a swarm as people belonging to different classes and proposes a hierarchical learning-based particle swarm optimizer (HLPSO). In it, particles hierarchically learn from the ones in either the same or upper level ones. The levels of particles are updated according to their fitness after each iteration. Since all particles determine respective leaders according to their own levels, the population hierarchically learns from a large number of potentially excellent positions, which greatly maintains the diversity of population and brings HLPSO a powerful exploration capability. The diversity analyses of HLPSO reveal that the hierarchical utilization of diversified leaders maintains population diversity. HLPSO and eight popular PSO contenders are tested on 28 CEC2013 benchmark functions. Experimental results indicate its high effectiveness and efficiency.