This paper investigates the physical layer security of inband underlay Device-to-Device (D2D) communication, where the direct link between D2D users is not available. In this respect, optimal relay and suboptimal relay selections are utilized to secure the D2D transmission. The eavesdropper uses either maximal-ratio combining or selection combining to increase the wiretapped signals. The D2D secrecy performance analysis is performed regarding the secrecy outage probability (SOP) and the probability of non-zero secrecy capacity, and closed-form expressions are provided for both relay selection approaches and verified using Monte-Carlo simulation. From the numerical results, it is shown that increasing the number of D2D relays enhances the secrecy performance of D2D communications. Moreover, the exact asymptotic analysis of the SOP is provided. It turns out that the diversity order of both relay selection approaches is the same.INDEX TERMS Physical layer security, D2D communications, secrecy outage probability, optimal and suboptimal relay selection, maximal-ratio combining, and selection combining., 1