Device-to-device (D2D) communication plays an important role in the next generation of communication systems. Enabling D2D communication decreases latency and expands the coverage of a cell in cellular networks. In addition, D2D underlaying cellular users benefit from high spectral efficiency. However, it creates interference to cellular communications. In this paper, we propose a genetic algorithm-based method to minimize the interference and maximize the spectral efficiency. One of the advantages of genetic algorithm is that it escapes from local maximums and evolves toward global maximum by searching different parts of search space simultaneously. Since D2D underlay cellular network degrades the signal-to-interference plus noise ratio (SINR), a minimum SINR is considered for cellular users. Numerical evaluations demonstrate the superior performance of the proposed technique in terms of spectral efficiency and interference mitigation.