Femtocell networks are an advantageous low-cost technology for providing indoor coverage and high-capacity solutions. Femtocell networks reuse the spectrum resources in co-channel environments due to its high geometric density. In this paper, a distributed algorithm is proposed, which uses a cluster-based self-organizing approach to managing the spectrum and power resources among femtocells. The aim of the proposed algorithm is to achieve an optimized throughput of the networks in a decentralized manner. The algorithm involves three phases: sensing phase, sniffer phase, and power control phase, and is performed in each femtocell. Simulation results indicate that the proposed algorithm improves the uplink throughput of the femtocell networks and effectively avoids interference with the conventional macro-cellular networks.