A vertex triple (u, v, w) with v adjacent to both u and w is called a 2-geodesic if u w and u, w are not adjacent. A graph Γ is said to be 2-geodesic-transitive if its automorphism group is transitive on both arcs and 2-geodesics. In this paper, a complete classification of 2-geodesic-transitive graphs is given which are neighbor cubic or neighbor tetravalent.