To support the surge in wireless data traffic, the spectrum and energy efficiencies of cellular networks should be largely increased. Heterogeneous two-tier architecture has been identified as one key solution. However, small-cell deployment raises questions about the resulting energy efficiency and interference mitigation. Therefore, we propose an energy-efficient and cognitive spectrum sharing scheme between primary macrocell and secondary small cells. Specifically, the small cells allocate their transmission power to maximize their total energy efficiency while respecting some interference constraints imposed by macrocell users. We solve this centralized optimization in two steps. First, assuming that the small-cell transmissions are noninterfering, the solution of this nonconvex optimization is characterized using a convex parametric approach. Using this characterization, we derive an algorithm based on Newton method, which converges to a global optimal solution. Second, when the small-cell transmissions are not necessarily orthogonal, we derive an algorithm, which converges at least to a local optimum, using the minorization-maximization principle and Newton method. Through simulations, we validate the convergence of these algorithms and compare their performance with existing schemes. We also analyze the effects of the interference and of the number of users on the energy efficiency.