For any real number α∈[0,1], by the Aα-matrix of a graph G we mean the matrix Aα(G)=αD(G)+(1−α)A(G), where A(G) and D(G) are the adjacency matrix and the diagonal matrix of vertex degrees of G, respectively. The largest eigenvalue of Aα(G) is called the Aα-index of G. In this paper, we settle the problem of characterizing graphs which attain the maximum Aα-index over G(n,n+k), the class of graphs with n vertices and n+k edges, for −1≤k≤n−3 and 12≤α<1. The following result is obtained: for −1≤k≤n−3, when 12≤α<1, Hn,k is the unique graph in G(n,n+k) that maximizes the Aα-index, except when (n,k)=(4,−1),(n,2) or (7,3) and α=12, or (n,k)=(5,1) and α∈[12,35−40924]. When (n,k,α)=(4,−1,12), the optimal graphs are H4,−1 and K3∪K1; when (n,k,α)=(n,2,12), the optimal graphs are Hn,2 and Gn,2; when (n,k,α)=(5,1,35−40924), the optimal graphs are H5,1 and K4∪K1; when (n,k,α)=(7,3,12), the optimal graphs are H7,3 and K5∪2K1; when (n,k)=(5,1) and 12≤α<35−40924, K4∪K1 is the unique graph that maximizes the Aα-index. Our work completes the corresponding work of Chang and Tam (2010) and Zhai et al. (2022) for the special case α=12. As a by-product, we provide a new proof for the known result that for any positive integer m and any real number α∈[12,1), if (m,α)≠(3,12), then a graph maximizes the Aα-index over all graphs with m edges if and only if it is the union of K1,m with a (possibly empty) null graph; a graph maximizes the A12-index over all graphs with three edges if and only if it is the union of K1,3 or K3 with a (possibly empty) null graph. Some open questions are also posed.