Femtocell is envisioned as a highly promising solution for indoor wireless communications. The spectrum allocated to femtocells is traditionally from the same licensed spectrum bands of macrocells. In this case, the capacity of femtocell networks is highly limited due to the finite number of licensed spectrum bands and also the interference with macrocells and other femtocells. In this paper, we propose a radically new communication paradigm by incorporating cognitive radio in femtocell networks. The cognitive radio enabled femtocells are able to access spectrum bands not only from macrocells but also from other licensed systems (e.g. TV systems) provided the interference from femtocells to the existing systems is not harmful. It results in more channel opportunities for femtocells. Thus, the co-channel interference in femtocells can be greatly reduced and the network capacity can be significantly improved. Because of the difference from other traditional wireless networks, we argue the traditional spectrum sharing schemes such as coloring methods are not efficient to femtocell networks especially for dense deployment scenarios. We formulate the downlink spectrum sharing problem in cognitive radio femtocell networks, and employ decomposition theories to solve the problem. Simulation results indicate that cognitive radio enabled femtocells could achieve much higher capacity than the femtocell networks which do not employ agile spectrum access. Simulation results also show that our proposed scheme without any iteration can achieve almost twice of the average capacity by coloring method when the number of available channels is less than five. Moreover, our proposed scheme can converge very fast with a typical value of only five iterations, and it can achieve around two percent extra average capacity than the fixed power control scheme.