In this paper, we show that among all connected graphs of order n with diameter D, the graph G∗ has maximal spectral radius, where G∗ is obtained from Kn−D⋁K2¯ by attaching two paths of order l1 and l2 to the two vertices u,v in K2¯, respectively, and l1+l2=D−2, |l1–l2|≤1.