In this paper, we investigate Device-to-Device (D2D) communication underlaying cellular networks to provide spectrally efficient support of local services. Since in underlay mode, D2D communications share resources in the time and frequency domains with cellular system, it will introduce potentially severe interference to the cellular users and accordingly presents a challenge in radio resource management. In order to avoid generating interference to the high-priority users (cellular users) operating on the same time-frequency resources and to optimize the throughput over the shared resources under the transmit power and the quality of service (QoS) constraints, we propose an interference alignment-based resource sharing scheme for D2D communication underlaying cellular networks. The simulation results demonstrate that by using the proposed scheme, D2D communication can effectively improve the total throughput without generating harmful interference to cellular networks.